/* ============================================================
   Rocky Shop — космическая тёмно-фиолетовая тема
   Применяется поверх bootstrap.css/site.css
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@300;400;500;600;700&family=Space+Grotesk:wght@400;500;700&display=swap');

:root {
    /* Глубокий фиолетово-пурпурный космос */
    --space-deep:    #07041a;
    --space-1:       #0d0628;
    --space-2:       #160b3e;
    --space-3:       #261354;
    --purple:        #4a1d8f;
    --purple-bright: #7c3fc7;
    --magenta-soft:  #b855e8;

    /* Акценты — приглушённые */
    --accent:        #a78bfa;
    --accent-bright: #c4b5fd;
    --gold:          #f0d77b;

    /* Текст */
    --ink:           #ffffff;
    --ink-soft:      #d8d2f0;
    --ink-dim:       #8b85a8;

    /* Стекло */
    --glass:         rgba(20, 12, 50, 0.5);
    --glass-strong:  rgba(20, 12, 50, 0.75);
    --glass-border:  rgba(167, 139, 250, 0.2);
    --glass-border-strong: rgba(167, 139, 250, 0.35);

    /* Состояния */
    --danger:        #ff6384;
    --danger-bg:     rgba(255, 99, 132, 0.12);
    --success:       #4ade80;
    --success-bg:    rgba(74, 222, 128, 0.15);
    --warning:       #fbbf24;
    --warning-bg:    rgba(251, 191, 36, 0.12);
}

/* Сброс — только базовый, не трогаем bootstrap полностью */
* {
    box-sizing: border-box;
}

/*
 * КРИТИЧНО для мобильных Safari/Chrome:
 * - overflow-x:hidden на html И body (не только на одном — Safari игнорирует если только на body)
 * - position:relative обязателен, иначе fixed-элементы создают горизонтальный скролл
 * - max-width:100vw как страховка от элементов которые шире viewport
 */
html {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%; /* iOS не должен увеличивать шрифты сам */
    background: var(--space-deep);
}

html, body {
    background: var(--space-deep) !important;
    color: var(--ink) !important;
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif !important;
    overflow-x: hidden;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 100vw;
}

body {
    position: relative;
    /* iOS Safari: предотвращает «прыжок» при появлении клавиатуры и горизонтальный сдвиг */
    -webkit-overflow-scrolling: touch;
}

/* ============================================================
   ГАЛАКТИКА — фон для всех страниц
   ============================================================ */

.galaxy {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 1400px 900px at 30% 20%,  rgba(124, 63, 199, 0.4),  transparent 55%),
        radial-gradient(ellipse 1100px 700px at 80% 60%,  rgba(184, 85, 232, 0.3),  transparent 55%),
        radial-gradient(ellipse 900px  600px at 50% 100%, rgba(74, 29, 143, 0.6),   transparent 55%),
        radial-gradient(ellipse 1800px 1200px at 50% 50%, var(--space-2) 0%, var(--space-1) 50%, var(--space-deep) 100%);
}

.milky-way {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.4;
    background:
        linear-gradient(115deg,
            transparent 30%,
            rgba(184, 85, 232, 0.15) 45%,
            rgba(167, 139, 250, 0.25) 50%,
            rgba(184, 85, 232, 0.15) 55%,
            transparent 70%);
    filter: blur(40px);
    transform: rotate(-8deg) scale(1.5);
}

.nebula {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    z-index: 0;
    pointer-events: none;
    mix-blend-mode: screen;
    /* Страховка от выхода за пределы viewport на мобильных */
    max-width: 100vw;
    will-change: transform; /* подсказка браузеру: оптимизируй анимацию */
}
.nebula-1 {
    width: 700px; height: 700px;
    background: radial-gradient(circle, var(--magenta-soft), transparent 70%);
    top: -150px; left: -200px;
    opacity: 0.55;
    animation: nebulaFloat1 40s ease-in-out infinite alternate;
}
.nebula-2 {
    width: 800px; height: 800px;
    background: radial-gradient(circle, var(--purple-bright), transparent 70%);
    bottom: -250px; right: -250px;
    opacity: 0.5;
    animation: nebulaFloat2 50s ease-in-out infinite alternate;
}
.nebula-3 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, var(--accent), transparent 70%);
    top: 50%; left: 60%;
    opacity: 0.3;
    animation: nebulaFloat3 45s ease-in-out infinite alternate;
}

@keyframes nebulaFloat1 {
    0%   { transform: translate(0, 0) scale(1) rotate(0deg); }
    100% { transform: translate(250px, 150px) scale(1.3) rotate(60deg); }
}
@keyframes nebulaFloat2 {
    0%   { transform: translate(0, 0) scale(1) rotate(0deg); }
    100% { transform: translate(-200px, -120px) scale(1.2) rotate(-45deg); }
}
@keyframes nebulaFloat3 {
    0%   { transform: translate(0, 0) scale(1) rotate(0deg); }
    100% { transform: translate(-150px, 200px) scale(1.4) rotate(90deg); }
}

.stars {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}
.stars-layer {
    position: absolute;
    inset: 0;
    background-repeat: repeat;
}
.stars-1 {
    background-image:
        radial-gradient(0.5px 0.5px at 20px 30px, rgba(255,255,255,0.7), transparent),
        radial-gradient(0.5px 0.5px at 60px 70px, rgba(255,255,255,0.5), transparent),
        radial-gradient(0.5px 0.5px at 130px 50px, rgba(255,255,255,0.6), transparent),
        radial-gradient(0.5px 0.5px at 200px 100px, rgba(255,255,255,0.7), transparent),
        radial-gradient(0.5px 0.5px at 280px 40px, rgba(255,255,255,0.4), transparent),
        radial-gradient(0.5px 0.5px at 50px 160px, rgba(255,255,255,0.6), transparent),
        radial-gradient(0.5px 0.5px at 170px 200px, rgba(255,255,255,0.5), transparent),
        radial-gradient(0.5px 0.5px at 250px 250px, rgba(255,255,255,0.7), transparent),
        radial-gradient(0.5px 0.5px at 90px 280px, rgba(255,255,255,0.4), transparent),
        radial-gradient(0.5px 0.5px at 220px 320px, rgba(255,255,255,0.6), transparent);
    background-size: 350px 350px;
    animation: twinkleA 5s ease-in-out infinite alternate;
}
.stars-2 {
    background-image:
        radial-gradient(1px 1px at 40px 90px, rgba(255,255,255,0.9), transparent),
        radial-gradient(1px 1px at 180px 40px, rgba(196, 181, 253, 0.8), transparent),
        radial-gradient(1px 1px at 290px 200px, white, transparent),
        radial-gradient(1px 1px at 100px 250px, rgba(255,255,255,0.7), transparent),
        radial-gradient(1px 1px at 230px 120px, rgba(184, 85, 232, 0.7), transparent),
        radial-gradient(1px 1px at 380px 300px, white, transparent);
    background-size: 500px 500px;
    background-position: 100px 100px;
    animation: twinkleB 7s ease-in-out infinite alternate;
}
.stars-3 {
    background-image:
        radial-gradient(1.5px 1.5px at 150px 150px, white, transparent),
        radial-gradient(2px 2px at 350px 250px, rgba(196, 181, 253, 0.9), transparent),
        radial-gradient(1.5px 1.5px at 500px 100px, white, transparent),
        radial-gradient(2px 2px at 600px 400px, rgba(184, 85, 232, 0.8), transparent);
    background-size: 800px 800px;
    background-position: 200px 200px;
    animation: twinkleC 9s ease-in-out infinite alternate;
}

@keyframes twinkleA { from { opacity: 0.4; } to { opacity: 0.9; } }
@keyframes twinkleB { from { opacity: 0.5; } to { opacity: 1; } }
@keyframes twinkleC { from { opacity: 0.6; } to { opacity: 1; } }

/* Падающие звёзды */
.shooting-star {
    position: fixed;
    width: 2px;
    height: 2px;
    background: white;
    border-radius: 50%;
    z-index: 1;
    pointer-events: none;
    box-shadow: 0 0 6px white, 0 0 16px rgba(196, 181, 253, 0.9);
    opacity: 0;
    --angle: 30deg;
    --distance: 500px;
    transform: rotate(var(--angle));
}
.shooting-star::before {
    content: "";
    position: absolute;
    top: 50%;
    right: 100%;
    width: 90px;
    height: 1px;
    background: linear-gradient(to left, white, rgba(196, 181, 253, 0.6) 30%, transparent 100%);
    transform-origin: right center;
    transform: translateY(-50%);
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.4);
}
.shooting-star::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 4px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(255, 255, 255, 0.6), transparent 70%);
    border-radius: 50%;
}

.shooting-star.s1 { top: 12%; left: 8%;  --angle: 28deg;   --distance: 600px; animation: shootFly 8s  ease-in infinite; }
.shooting-star.s2 { top: 22%; left: 75%; --angle: 152deg;  --distance: 550px; animation: shootFly 11s ease-in infinite; animation-delay: 3s; }
.shooting-star.s3 { top: 68%; left: 22%; --angle: -22deg;  --distance: 700px; animation: shootFly 13s ease-in infinite; animation-delay: 6s; }
.shooting-star.s4 { top: 8%;  left: 40%; --angle: 12deg;   --distance: 650px; animation: shootFly 14s ease-in infinite; animation-delay: 2s; }
.shooting-star.s5 { top: 5%;  left: 90%; --angle: 168deg;  --distance: 800px; animation: shootFly 16s ease-in infinite; animation-delay: 9s; }
.shooting-star.s6 { top: 82%; left: 78%; --angle: -158deg; --distance: 600px; animation: shootFly 12s ease-in infinite; animation-delay: 5s; }
.shooting-star.s7 { top: 45%; left: 60%; --angle: 142deg;  --distance: 500px; animation: shootFly 15s ease-in infinite; animation-delay: 11s; }

@keyframes shootFly {
    0%, 93%  { opacity: 0; transform: rotate(var(--angle)) translateX(0); }
    95%      { opacity: 1; }
    99%      { opacity: 1; }
    100%     { opacity: 0; transform: rotate(var(--angle)) translateX(var(--distance)); }
}

/* ============================================================
   ОБЩАЯ СЕТКА
   ============================================================ */

.app-wrapper {
    position: relative;
    z-index: 10;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-content {
    flex: 1;
    width: 100%;
}

.frame {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ============================================================
   HEADER
   ============================================================ */

.site-header {
    position: relative;
    z-index: 20;
    background: rgba(7, 4, 26, 0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--glass-border);
}

.site-header .frame {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
    padding-bottom: 14px;
    gap: 24px;
    flex-wrap: wrap;
}

.site-header .logo img {
    height: 56px;
    width: auto;
    display: block;
    filter: drop-shadow(0 0 14px rgba(184, 85, 232, 0.4));
    transition: filter 0.3s;
}

.site-header .logo:hover img {
    filter: drop-shadow(0 0 22px rgba(184, 85, 232, 0.7));
}

.site-nav {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.site-nav a {
    color: var(--ink-soft);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    padding: 9px 16px;
    border-radius: 10px;
    transition: all 0.2s;
    display: inline-block;
}

.site-nav a:hover {
    color: var(--ink);
    background: rgba(167, 139, 250, 0.12);
}

.site-nav .btn-logout {
    color: var(--accent-bright);
}

.site-nav .btn-logout:hover {
    background: rgba(255, 99, 132, 0.15);
    color: #ff8aa3;
}

/* Бейдж баланса */
.balance-badge {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, rgba(124, 63, 199, 0.25), rgba(184, 85, 232, 0.18));
    border: 1px solid var(--glass-border-strong);
    padding: 8px 16px;
    border-radius: 100px;
    font-size: 14px;
    color: var(--ink-soft);
}

.balance-badge .balance-status {
    color: var(--accent-bright);
    font-weight: 700;
    font-size: 15px;
}

.balance-badge .balance-add {
    background: var(--accent);
    color: var(--space-deep);
    text-decoration: none;
    padding: 4px 12px;
    border-radius: 100px;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s;
}

.balance-badge .balance-add:hover {
    background: var(--accent-bright);
    transform: translateY(-1px);
}

/* Бургер-кнопка для мобильного меню */
.nav-burger {
    display: none;
    background: none;
    border: 1px solid var(--glass-border-strong);
    color: var(--ink);
    width: 42px;
    height: 42px;
    border-radius: 10px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.nav-burger svg {
    width: 22px; height: 22px;
}

/* ============================================================
   КНОПКИ
   ============================================================ */

.btn,
button[type="submit"],
.payment-form button[type="submit"] {
    padding: 14px 28px;
    border-radius: 12px;
    font-family: 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 15px;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
    text-align: center;
    display: inline-block;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

.btn-primary,
button[type="submit"]:not(.btn-secondary):not(.btn-ghost),
.payment-form button[type="submit"] {
    background: linear-gradient(135deg, var(--purple-bright), var(--magenta-soft)) !important;
    color: white !important;
    box-shadow:
        0 8px 24px rgba(124, 63, 199, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    border: none !important;
}

.btn-primary:hover,
button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow:
        0 12px 32px rgba(184, 85, 232, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    color: white;
}

.btn-secondary {
    background: rgba(167, 139, 250, 0.08);
    color: var(--ink);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(167, 139, 250, 0.18);
    border-color: var(--accent);
    transform: translateY(-2px);
    color: var(--ink);
}

.btn-ghost {
    background: transparent;
    color: var(--accent-bright);
    border: 1px solid var(--glass-border);
}

.btn-ghost:hover {
    background: rgba(167, 139, 250, 0.08);
    border-color: var(--accent);
    color: var(--ink);
}

.btn-full { width: 100%; }

/* ============================================================
   ХЛЕБНЫЕ КРОШКИ
   ============================================================ */

.breadcrumb {
    background: transparent;
    padding: 24px 0 8px;
    margin: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 13px;
    color: var(--ink-dim);
}

.breadcrumb li {
    display: flex;
    align-items: center;
    gap: 6px;
}

.breadcrumb li:not(:first-child)::before {
    content: "›";
    color: var(--ink-dim);
    margin-right: 6px;
}

.breadcrumb a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}
.breadcrumb a:hover { color: var(--accent-bright); }
.breadcrumb .active { color: var(--ink-soft); }

/* ============================================================
   ТИПОГРАФИКА
   ============================================================ */

.general-ttl {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(28px, 4vw, 42px);
    color: var(--ink);
    letter-spacing: -0.5px;
    margin: 16px 0 24px;
    line-height: 1.15;
}

h1, h2, h3, h4 {
    font-family: 'Space Grotesk', sans-serif;
    color: var(--ink);
}

p { color: var(--ink-soft); line-height: 1.6; }

a { color: var(--accent); transition: color 0.2s; }
a:hover { color: var(--accent-bright); text-decoration: none; }

code {
    background: rgba(7, 4, 26, 0.7);
    color: var(--accent-bright);
    padding: 4px 10px;
    border-radius: 6px;
    font-family: 'Space Grotesk', monospace;
    border: 1px solid var(--glass-border);
}

/* ============================================================
   СОДЕРЖИМОЕ
   ============================================================ */

.content-wrap {
    padding: 24px 0;
    position: relative;
    z-index: 5;
}

/* ============================================================
   КАРТОЧКИ И «СТЕКЛО»
   ============================================================ */

.glass-card {
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 32px;
    box-shadow:
        0 24px 60px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.admin-info {
    background: rgba(167, 139, 250, 0.08);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 16px 20px;
    color: var(--ink-soft);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.admin-info a { color: var(--accent-bright); font-weight: 600; }

.balance-info {
    color: var(--ink-soft);
    font-size: 16px;
    margin: 16px 0 24px;
}
.balance-info .referal-link {
    color: var(--accent-bright);
    font-weight: 700;
}

/* ============================================================
   СПИСКИ КАТЕГОРИЙ И ТОВАРОВ
   ============================================================ */

.category-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    /* Минимум 200px на карточку. При 10+ категориях сетка автоматически растягивается на больше колонок */
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.category-list li {
    margin: 0;
}

.category-list a {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 26px 18px;
    /* Двойной градиент-фон под стиль варианта 1 */
    background:
        linear-gradient(135deg, rgba(124, 63, 199, 0.35), rgba(184, 85, 232, 0.20)),
        rgba(20, 12, 50, 0.85);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    min-height: 90px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    line-height: 1.35;
    /* Длинные названия будут переноситься */
    word-wrap: break-word;
    hyphens: auto;
}

/* Внутренний слой — появляется на hover, добавляет глубины */
.category-list a::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent, rgba(184, 85, 232, 0.12));
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.category-list a:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    color: var(--ink);
    box-shadow: 0 16px 32px rgba(124, 63, 199, 0.4);
}

.category-list a:hover::before {
    opacity: 1;
}

/* Активная категория (если когда-то будете подсвечивать выбранную) */
.category-list a.is-active {
    border-color: var(--magenta-soft);
    background: linear-gradient(135deg, rgba(184, 85, 232, 0.2), rgba(124, 63, 199, 0.1));
    box-shadow: 0 0 24px rgba(184, 85, 232, 0.3);
}

.product-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.product-list li { margin: 0; }

.product-list > li > a {
    display: block;
    text-decoration: none;
    color: inherit;
}

.product-item {
    background: var(--glass);
    backdrop-filter: blur(14px);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 18px;
    transition: all 0.3s;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.product-list > li > a:hover .product-item {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 16px 40px rgba(124, 63, 199, 0.35);
}

.product-item img {
    width: 130px;
    height: 130px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 14px;
    border: 1px solid var(--glass-border);
    background: rgba(7, 4, 26, 0.6);
}

.product-item h2 {
    font-size: 16px;
    margin: 0 0 10px;
    color: var(--ink);
    font-weight: 600;
    font-family: 'Manrope', sans-serif;
    line-height: 1.3;
}

.product-item p {
    color: var(--accent-bright);
    font-weight: 700;
    font-size: 17px;
    margin: 0;
    font-family: 'Space Grotesk', sans-serif;
}

.centered-message {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 50vh;
    text-align: center;
    color: var(--ink-soft);
    font-size: 17px;
}

/* ============================================================
   ФОРМЫ
   ============================================================ */

.payment-form {
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 36px;
    max-width: 460px;
    margin: 0 auto;
    box-shadow:
        0 24px 60px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.payment-form .form-row,
.payment-form .form-group {
    margin-bottom: 18px;
}

.payment-form label,
.payment-form .control-label {
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
    display: block;
}

.payment-form input[type="text"],
.payment-form input[type="password"],
.payment-form input[type="email"],
.payment-form input[type="number"],
.payment-form .form-control,
.form-control,
input.form-control {
    width: 100%;
    background: rgba(7, 4, 26, 0.6) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 12px !important;
    padding: 14px 16px !important;
    color: var(--ink) !important;
    font-family: 'Manrope', sans-serif;
    font-size: 15px;
    outline: none;
    transition: all 0.2s;
    box-shadow: none !important;
    height: auto !important;
}

.payment-form input::placeholder,
.form-control::placeholder { color: var(--ink-dim); }

.payment-form input:focus,
.form-control:focus {
    border-color: var(--accent) !important;
    background: rgba(167, 139, 250, 0.05) !important;
    box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.15) !important;
}

/* Радиокнопки оплаты */
#addfundsform-mode {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-top: 8px;
}

#addfundsform-mode label {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(7, 4, 26, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px 14px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--ink-soft);
    font-weight: 500;
    font-size: 14px;
    margin: 0;
}

#addfundsform-mode label:hover {
    border-color: var(--accent);
    background: rgba(167, 139, 250, 0.08);
    color: var(--ink);
}

#addfundsform-mode input[type="radio"] {
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.checkbox label {
    color: var(--ink-soft);
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
}

.checkbox input[type="checkbox"] {
    accent-color: var(--accent);
    width: 16px; height: 16px;
}

/* Алерты */
.alert {
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 18px;
    font-size: 14px;
    border: 1px solid transparent;
}

.alert-danger {
    background: var(--danger-bg) !important;
    border-color: rgba(255, 99, 132, 0.3) !important;
    color: #ffaab8 !important;
}

.alert-success {
    background: var(--success-bg);
    border-color: rgba(74, 222, 128, 0.3);
    color: #a7f3d0;
}

.alert-custom {
    background: var(--warning-bg);
    border: 1px solid rgba(251, 191, 36, 0.3);
    color: #fde68a;
}

.alert-info {
    background: rgba(124, 63, 199, 0.15);
    border: 1px solid var(--glass-border);
    color: var(--ink-soft);
}

/* ============================================================
   КОШЕЛЁК / ОПЛАТА
   ============================================================ */

.wallet-info {
    background: var(--glass);
    backdrop-filter: blur(14px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 32px;
    margin: 24px auto;
    max-width: 600px;
    text-align: center;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}

.wallet-summary { margin-bottom: 18px; }
.wallet-summary .label { color: var(--ink-dim); font-weight: 500; }
.wallet-summary .value { color: var(--ink); font-weight: 600; font-size: 16px; }
.wallet-summary p { margin: 6px 0; }

.wallet-address {
    color: var(--accent-bright);
    word-break: break-all;
    font-size: 17px;
    font-family: 'Space Grotesk', monospace;
    background: rgba(7, 4, 26, 0.6);
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    margin: 8px 0;
}

.wallet-amount {
    color: var(--gold);
    font-size: 22px;
    font-weight: 700;
    margin: 8px 0;
    font-family: 'Space Grotesk', sans-serif;
}

.qr-code img {
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    background: white;
    padding: 8px;
}

.payment-id-box {
    background: rgba(167, 139, 250, 0.1);
    border: 1px dashed var(--accent);
    border-radius: 12px;
    padding: 14px 18px;
    margin: 16px 0;
    color: var(--ink-soft);
    font-size: 14px;
    text-align: left;
}
.payment-id-box strong { color: var(--accent-bright); }
.payment-id-box .pid {
    display: inline-block;
    background: rgba(7, 4, 26, 0.7);
    color: var(--accent-bright);
    padding: 4px 10px;
    border-radius: 6px;
    font-family: 'Space Grotesk', monospace;
    font-weight: 600;
    margin-left: 6px;
    user-select: all;
    word-break: break-all;
}

.success-message {
    background: var(--success-bg);
    border: 1px solid rgba(74, 222, 128, 0.3);
    color: #a7f3d0;
    border-radius: 20px;
    padding: 32px;
    text-align: center;
    margin: 32px auto;
    max-width: 700px;
}
.success-message .icon { font-size: 56px; color: #4ade80; margin-bottom: 12px; }
.success-text { font-size: 22px; font-weight: 700; color: #a7f3d0; }
.success-text code {
    display: inline-block;
    margin-top: 12px;
    font-size: 17px;
}

.lighter { color: var(--accent-bright); font-weight: 700; }

.make-order { text-align: center; margin: 24px 0; }
.btn-custom {
    background: linear-gradient(135deg, var(--purple-bright), var(--magenta-soft));
    color: white;
    text-decoration: none;
    padding: 12px 28px;
    border-radius: 12px;
    display: inline-block;
    font-weight: 600;
    transition: all 0.25s;
    border: none;
}
.btn-custom:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(184, 85, 232, 0.5);
    color: white;
}

/* ============================================================
   ТАБЛИЦА (DataTables)
   ============================================================ */

.responsive-table {
    overflow-x: auto;
    background: var(--glass);
    backdrop-filter: blur(14px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 16px;
}

#transactionTable, table.dataTable {
    background: transparent !important;
    color: var(--ink-soft) !important;
    border-collapse: collapse;
    width: 100%;
}

#transactionTable thead, table.dataTable thead {
    background: transparent !important;
}

#transactionTable thead th, table.dataTable thead th {
    background: rgba(7, 4, 26, 0.5) !important;
    color: var(--ink) !important;
    font-weight: 600;
    border: none !important;
    border-bottom: 1px solid var(--glass-border) !important;
    padding: 14px 12px !important;
}

#transactionTable tbody td, table.dataTable tbody td {
    color: var(--ink-soft) !important;
    border-bottom: 1px solid rgba(167, 139, 250, 0.08) !important;
    background: transparent !important;
    padding: 14px 12px !important;
}

#transactionTable tbody tr:hover td, table.dataTable tbody tr:hover td {
    background: rgba(167, 139, 250, 0.06) !important;
}

#transactionTable tbody tr, table.dataTable tbody tr {
    background: transparent !important;
}

#transactionTable tfoot, table.dataTable tfoot { background: transparent !important; }

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    background: rgba(7, 4, 26, 0.6) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 8px !important;
    color: var(--ink) !important;
    padding: 6px 10px !important;
    margin-left: 6px;
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_paginate {
    color: var(--ink-soft) !important;
    margin-top: 12px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    color: var(--ink-soft) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 6px !important;
    padding: 5px 11px !important;
    background: transparent !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--accent) !important;
    color: var(--space-deep) !important;
    border-color: var(--accent) !important;
}

/* ============================================================
   FOOTER (одна кнопка поддержки)
   ============================================================ */

.main-footer {
    position: relative;
    z-index: 5;
    margin-top: auto;
    padding: 24px;
    text-align: center;
    border-top: 1px solid var(--glass-border);
    background: rgba(7, 4, 26, 0.5);
    backdrop-filter: blur(8px);
}

.main-footer .footer-nav {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}

.main-footer .footer-nav a {
    color: var(--accent);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.main-footer .footer-nav a:hover { color: var(--accent-bright); }

.footer-copy {
    color: var(--ink-dim);
    font-size: 12px;
    margin-top: 8px;
}

/* ============================================================
   КОНТАКТЫ
   ============================================================ */

.contacts-block {
    max-width: 700px;
    margin: 24px auto;
}

.contact-item {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    padding: 22px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    margin-bottom: 16px;
    transition: all 0.25s;
}

.contact-item:hover {
    border-color: var(--accent);
    background: rgba(167, 139, 250, 0.08);
}

.contact-icon {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--purple-bright), var(--magenta-soft));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 8px 20px rgba(124, 63, 199, 0.4);
}

.contact-icon svg { width: 24px; height: 24px; }

.contact-body { flex: 1; min-width: 0; }
.contact-body h3 {
    font-size: 16px;
    color: var(--ink);
    margin: 0 0 6px;
    font-family: 'Manrope', sans-serif;
    font-weight: 700;
}
.contact-body .contact-link {
    color: var(--accent-bright);
    font-weight: 600;
    text-decoration: none;
    word-break: break-all;
}
.contact-body .contact-text {
    color: var(--ink-soft);
    font-size: 14px;
    line-height: 1.6;
    margin-top: 8px;
    word-wrap: break-word;
    white-space: pre-wrap;
}

/* ============================================================
   МОБИЛЬНАЯ АДАПТАЦИЯ
   ============================================================ */

@media (max-width: 900px) {
    .frame { padding: 0 16px; }

    .nav-burger { display: inline-flex; }

    .site-header .frame {
        flex-wrap: wrap;
        gap: 12px;
    }

    .site-nav-wrap {
        order: 99;
        width: 100%;
        display: none;
    }

    .site-nav-wrap.is-open { display: block; }

    .site-nav {
        flex-direction: column;
        gap: 4px;
        padding: 12px 0;
        border-top: 1px solid var(--glass-border);
        margin-top: 8px;
    }

    .site-nav a {
        display: block;
        padding: 12px 14px;
    }

    .balance-badge { font-size: 13px; padding: 6px 12px; }
    .balance-badge .balance-add { font-size: 12px; padding: 3px 10px; }

    .general-ttl { font-size: 26px; }

    .payment-form { padding: 28px 22px; }

    .product-item img { width: 110px; height: 110px; }
    .product-list { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
    .category-list {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }
    .category-list a {
        padding: 20px 14px;
        font-size: 15px;
        min-height: 76px;
        border-radius: 14px;
    }

    .wallet-info, .glass-card { padding: 22px; }

    .contact-item { padding: 18px; gap: 14px; }
}

@media (max-width: 480px) {
    .site-header .logo img { height: 44px; }
    .balance-badge { gap: 8px; }
    .breadcrumb { font-size: 12px; }
    #addfundsform-mode { grid-template-columns: 1fr 1fr; }
    .category-list {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .category-list a {
        padding: 18px 12px;
        font-size: 14px;
        min-height: 68px;
    }
}


/* ============================================================
   КРИТИЧНЫЕ ФИКСЫ ДЛЯ МОБИЛЬНЫХ БРАУЗЕРОВ
   (iOS Safari, Android Chrome / Samsung Internet)
   Эти правила решают проблему "контент уезжает за viewport вправо"
   ============================================================ */

@media (max-width: 768px) {

    /* Все обёртки на всю ширину viewport — без выпадений и переполнений */
    .app-wrapper,
    .app-content,
    .content-wrap,
    .site-header,
    .main-footer {
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }

    /* Frame — внешний контейнер всех страниц.
       Гарантируем что он точно вписывается в экран. */
    .frame {
        width: 100%;
        max-width: 100vw;
        padding-left: 16px;
        padding-right: 16px;
    }

    /* Туманности на мобильных уменьшаем и приближаем к центру,
       чтобы они никогда не вылезали за края */
    .nebula-1 {
        width: 360px;
        height: 360px;
        top: -80px;
        left: -100px;
    }
    .nebula-2 {
        width: 380px;
        height: 380px;
        bottom: -120px;
        right: -120px;
    }
    .nebula-3 {
        width: 280px;
        height: 280px;
        top: 50%;
        left: 30%;
        opacity: 0.2;
    }

    /* Анимации туманностей — ограничиваем смещения, чтобы не уезжали в бесконечность */
    @keyframes nebulaFloat1 {
        0%   { transform: translate(0, 0) scale(1); }
        100% { transform: translate(80px, 80px) scale(1.1); }
    }
    @keyframes nebulaFloat2 {
        0%   { transform: translate(0, 0) scale(1); }
        100% { transform: translate(-60px, -60px) scale(1.1); }
    }
    @keyframes nebulaFloat3 {
        0%   { transform: translate(0, 0) scale(1); }
        100% { transform: translate(-40px, 60px) scale(1.15); }
    }

    /* Падающие звёзды на мобильных уменьшаем дистанцию,
       чтобы они не растягивали layout */
    .shooting-star { display: none; } /* проще убрать на мобильных — артефакты рендера */

    /* Млечный путь — уменьшаем blur и масштаб (тяжёлый для мобилок) */
    .milky-way {
        opacity: 0.25;
        filter: blur(20px);
        transform: rotate(-8deg) scale(1);
    }

    /* iOS Safari: backdrop-filter работает плохо или вызывает прозрачность.
       Делаем плотный фон стеклу, чтобы текст всегда был читаем. */
    .glass-card,
    .payment-form,
    .wallet-info,
    .contact-item,
    .product-item,
    .category-list a,
    .responsive-table,
    .balance-badge {
        background: rgba(20, 12, 50, 0.85) !important;
        -webkit-backdrop-filter: blur(8px);
        backdrop-filter: blur(8px);
    }

    .site-header {
        background: rgba(7, 4, 26, 0.92) !important;
        -webkit-backdrop-filter: blur(10px);
        backdrop-filter: blur(10px);
    }

    .main-footer {
        background: rgba(7, 4, 26, 0.92) !important;
    }

    /* Формы: вход и регистрация — гарантированная ширина 100% */
    .payment-form {
        max-width: 100%;
        width: 100%;
        margin-left: auto;
        margin-right: auto;
    }

    /* Inputs: iOS любит обрезать или увеличивать */
    .payment-form input[type="text"],
    .payment-form input[type="password"],
    .payment-form input[type="email"],
    .payment-form input[type="number"],
    .payment-form .form-control,
    .form-control,
    input.form-control {
        font-size: 16px !important; /* iOS не зумит при фокусе только если шрифт >= 16px */
        max-width: 100%;
        width: 100%;
    }

    /* Длинные слова и URL не должны разрывать layout */
    body, p, a, h1, h2, h3, h4, .contact-text, .wallet-address {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    /* Таблица заказов: горизонтальный скролл ВНУТРИ контейнера, а не страницы */
    .responsive-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }

    /* Cloudflare Turnstile блок — центрируем и предотвращаем переполнение */
    .cf-turnstile {
        max-width: 100%;
        overflow: hidden;
    }

    /* Главная страница: лого и кнопки */
    .home-stage {
        padding: 80px 16px 40px !important;
        width: 100%;
        max-width: 100vw;
    }

    .home-cta {
        max-width: 100%;
        width: 100%;
        padding: 0 4px;
    }
}


/* ============================================================
   Дополнительный таргетинг iOS Safari (старые версии)
   ============================================================ */

@supports (-webkit-touch-callout: none) {
    /* iOS Safari конкретно */
    .glass-card,
    .payment-form,
    .wallet-info,
    .contact-item {
        /* iOS до версии 14 не поддерживал backdrop-filter — делаем плотный фон */
        background: rgba(20, 12, 50, 0.88);
    }
}


/* ============================================================
   Самые маленькие экраны (320–360px)
   ============================================================ */

@media (max-width: 380px) {
    .frame { padding-left: 12px; padding-right: 12px; }
    .general-ttl { font-size: 22px; }
    .payment-form { padding: 22px 18px; }
    .glass-card, .wallet-info { padding: 18px; }
    .contact-item { padding: 14px; gap: 10px; }
    .contact-icon { flex: 0 0 40px; width: 40px; height: 40px; }
    .contact-icon svg { width: 20px; height: 20px; }
    .breadcrumb { font-size: 11px; }
    .site-header .logo img { height: 40px; }
}
