:root {
    --bg-dark: #020402;
    --card-bg: #061f14; 
    --primary: #00ff88;
    --primary-dim: rgba(0, 255, 136, 0.15);
    --accent-orange: #ff9f43; 
    --text-main: #f0fdf4;
    --text-muted: #86efac;
    --border: rgba(0, 255, 136, 0.3);
    --neon: 0 0 15px rgba(0, 255, 136, 0.5);
    --error: #ef4444;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; -webkit-tap-highlight-color: transparent; }

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex; flex-direction: column;
    background-image: linear-gradient(rgba(0, 255, 136, 0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(0, 255, 136, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    overflow-x: hidden;
}

/* --- HEADER --- */
header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 15px 5%; border-bottom: 1px solid var(--border);
    background: rgba(2, 4, 2, 0.9); backdrop-filter: blur(10px);
    position: sticky; top: 0; z-index: 100;
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 1.4rem; color: var(--primary); text-shadow: 0 0 10px rgba(0,255,136,0.5); white-space: nowrap; }
.logo-icon { width: 35px; height: 35px; background: linear-gradient(135deg, #00ff88, #059669); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #000; box-shadow: var(--neon); flex-shrink: 0; }

.wallet-info { 
    display: flex; 
    align-items: center; 
    min-width: 0; 
    justify-content: flex-end;
    gap: 10px;
}

/* NETWORK SWITCHER */
.network-switcher { position: relative; display: inline-block; }
.network-select { background: rgba(0, 255, 136, 0.05); border: 1px solid var(--primary); color: var(--primary); padding: 8px 12px; border-radius: 8px; font-weight: 700; outline: none; text-align: center; font-size: 0.9rem; cursor: pointer; min-width: 80px; }
.network-dropdown-content { display: none; position: absolute; top: 100%; right: 0; z-index: 100; min-width: 100%; margin-top: 5px; background-color: #121212; border: 1px solid var(--primary); border-radius: 8px; overflow: hidden; }
.network-dropdown-content button { text-align: center; width: 100%; padding: 10px 15px; background: none; border: none; color: #fff; cursor: pointer; font-weight: 700; font-size: 0.9rem; transition: background-color 0.2s; }
.network-dropdown-content button:hover { background-color: rgba(0, 255, 136, 0.1); color: var(--primary); }
.network-dropdown-content.show { display: block; }

.btn-connect {
    background: transparent; color: var(--primary); border: 2px solid var(--primary);
    padding: 8px 16px; border-radius: 8px; font-weight: 700; cursor: pointer; transition: 0.3s;
    font-size: 0.9rem; white-space: nowrap;
}
.btn-connect:hover { background: var(--primary); color: #000; box-shadow: var(--neon); }
.btn-connect.connected { border-color: var(--primary); color: #fff; background: rgba(0, 255, 136, 0.1); }
.btn-connect.connected:hover { background: var(--error); border-color: var(--error); color: #fff; content: "Disconnect"; }

/* --- MAIN LAYOUT --- */
main { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 40px; padding: 40px 15px; width: 100%; max-width: 1100px; margin: 0 auto; }

h2 { color: #fff; margin-bottom: 20px; text-transform: uppercase; font-size: 1.4rem; font-weight: 800; display: flex; align-items: center; gap: 10px; }
h2 i { color: var(--primary); }

.card {
    background: var(--card-bg); border: 1px solid var(--border);
    padding: 30px; border-radius: 20px; width: 100%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5); position: relative; overflow: hidden;
    /* ИЗМЕНЕНИЕ: Добавляем выравнивание для центрирования inline-block кнопок */
    text-align: center; 
}
.card::before {
    content: ''; position: absolute; top:0; left:0; width:100%; height:6px;
    background: linear-gradient(90deg, var(--primary), #004422);
    box-shadow: 0 0 10px var(--primary);
}
/* Восстанавливаем выравнивание для внутренних элементов */
.card h2, .card .stats-grid, .card .input-group, .card .user-stakes-container, .card .staking-plans {
    text-align: left;
}
.card .staking-calculator {
    text-align: initial;
}

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 20px; }
.stat-box { background: rgba(0,0,0,0.4); border: 1px solid #333; border-radius: 12px; padding: 15px; text-align: center; display: flex; flex-direction: column; gap: 5px; }
.stat-label { font-size: 0.75rem; color: var(--primary); font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.stat-value { font-size: 1.1rem; color: var(--accent-orange); font-family: monospace; font-weight: bold; text-shadow: 0 0 5px rgba(255, 159, 67, 0.3); }

.input-group label { display: block; margin-bottom: 8px; color: var(--primary); font-size: 0.85rem; text-transform: uppercase; font-weight: 700; letter-spacing: 0.5px; text-align: left;}
.input-wrapper { display: flex; align-items: center; background: #020b05; border: 1px solid #333; border-radius: 10px; padding-right: 15px; transition: 0.3s; position: relative; }
.input-wrapper:focus-within { border-color: var(--primary); box-shadow: 0 0 10px rgba(0,255,136,0.1); }
input { width: 100%; background: transparent; border: none; padding: 18px; color: #fff; font-size: 1.3rem; font-family: monospace; outline: none; }
.currency { font-weight: 900; color: var(--primary); font-size: 1.2rem; }

.btn-max {
    background: rgba(0, 255, 136, 0.15); color: var(--primary); border: 1px solid var(--primary);
    padding: 4px 8px; border-radius: 4px; font-size: 0.7rem; font-weight: bold; cursor: pointer;
    margin-right: 10px; transition: 0.2s;
}
.btn-max:hover { background: var(--primary); color: #000; }

/* Стили для кнопки CLAIM/UNSTAKE */
.btn-claim { padding: 10px; width: 100%; background: transparent; border: 1px solid var(--primary); color: var(--primary); border-radius: 6px; font-weight: 700; cursor: pointer; margin-top: 5px; }
.btn-claim:hover { background: var(--primary); color: #000; }
.btn-claim:disabled { border-color: #444; color: #555; background: transparent; cursor: not-allowed; }


.btn-mint-nft[disabled] {
/* Добавьте !important, чтобы перебить любые накладывающиеся правила. */
cursor: default !important; 
}

.btn-mint-nft {
/* Для всех остальных состояний (когда кнопка активна) */
cursor: pointer;
}

/* --- WALLET MONITOR --- */
.wallet-monitor { display: flex; align-items: center; background: rgba(6, 31, 20, 0.8); border: 1px solid rgba(0, 255, 136, 0.3); border-radius: 12px; padding: 5px 15px; margin-right: 10px; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3); backdrop-filter: blur(5px); height: 42px; }
.balance-group { display: flex; flex-direction: column; justify-content: center; align-items: flex-end; line-height: 1.1; }
.balance-label { font-size: 0.65rem; color: #86efac; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.balance-value { font-family: 'Inter', monospace; font-size: 0.95rem; font-weight: 700; color: #fff; white-space: nowrap; }
.mcf-group .balance-value { color: #00ff88; text-shadow: 0 0 8px rgba(0, 255, 136, 0.4); }
.balance-divider { width: 1px; height: 24px; background: rgba(255, 255, 255, 0.15); margin: 0 12px; }

/* --- SPACE BUTTON STYLES (Green Adapted) --- */

/* Контейнер для градиентной рамки */
.button-container {
    position: relative;
    /* ИЗМЕНЕНИЕ: display: inline-block; - занимает только необходимую ширину */
    display: inline-block; 
    max-width: 100%; 
    padding: 2px; 
    border-radius: 14px;
    margin-top: 25px;
    
    /* Центрируем контейнер, если он не на 100% */
    margin-left: auto;
    margin-right: auto;
    
    background: linear-gradient(90deg, #00ff88, #004422, #059669, #00ff88);
    background-size: 400% 400%;
    animation: gradientBorder 10s ease-in-out infinite;
    
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.2);
    transform: translateZ(0);
    will-change: transform;
}

.space-button {
    position: relative;
    /* ИЗМЕНЕНИЕ: убираем width: 100% - ширина определяется padding */
    width: 100%; 
    padding: 18px 40px; /* Увеличил горизонтальный паддинг для размера */
    font-size: 1.2rem;
    font-weight: 900;
    font-family: 'Inter', sans-serif;
    color: #fff;
    
    /* Темно-зеленый фон внутри кнопки */
    background: linear-gradient(45deg, #020b05, #0a1f16);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Зеленое свечение */
    box-shadow: 
        inset 0 0 20px rgba(0, 255, 136, 0.05);
    
    text-transform: uppercase;
    letter-spacing: 1px;
    z-index: 1;
}

/* Текст внутри кнопки */
.space-button span {
    position: relative;
    z-index: 5;
    background: linear-gradient(to bottom, #ffffff, #ccffdd);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent; /* Чтобы работал градиент текста */
    filter: drop-shadow(0 0 8px rgba(0, 255, 136, 0.5));
}

/* Анимация частиц (Part 1) */
.space-button::before {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: 
        radial-gradient(1px 1px at 10% 15%, rgba(255,255,255,0.9), transparent),
        radial-gradient(1.5px 1.5px at 85% 25%, rgba(255,255,255,0.9), transparent),
        radial-gradient(1px 1px at 50% 50%, rgba(0,255,136,0.8), transparent); /* Зеленая частица */
    animation: moveParticles1 20s linear infinite;
    opacity: 0.4;
    pointer-events: none;
    z-index: 2;
}

/* Анимация частиц (Part 2) */
.space-button::after {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: inherit;
    animation: moveParticles2 18s linear infinite;
    transform: rotate(25deg);
    opacity: 0.3;
    pointer-events: none;
    z-index: 3;
}

/* Эффект наведения */
.space-button:hover {
    background: linear-gradient(45deg, #061f14, #00331a);
    box-shadow: inset 0 0 30px rgba(0, 255, 136, 0.2);
    
}

.button-container:hover {
    box-shadow: 0 0 25px rgba(0, 255, 136, 0.4); /* Яркое свечение рамки */
}

.space-button:hover span {
    filter: drop-shadow(0 0 15px rgba(0, 255, 136, 0.8));
}

/* Отключение кнопки */
.space-button:disabled {
    background: #111;
    cursor: not-allowed;
    opacity: 0.7;
}
.button-container:has(button:disabled) {
    animation: none;
    background: #333;
    box-shadow: none;
}

/* Bright Particles Layer */
.space-button .bright-particles {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    /* Добавил зеленых частиц */
    background: 
        radial-gradient(2px 2px at 15% 25%, rgba(255,255,255,1), transparent),
        radial-gradient(1.8px 1.8px at 85% 15%, rgba(0,255,136,0.9), transparent),
        radial-gradient(2.2px 2.2px at 65% 35%, rgba(255,255,255,0.8), transparent);
    animation: moveParticles4 15s linear infinite;
    opacity: 0.6;
    mix-blend-mode: screen;
    pointer-events: none;
    z-index: 4;
}

/* Анимации (Keyframes) */
@keyframes moveParticles1 {
    0% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(10px, 10px) rotate(180deg); }
    100% { transform: translate(0, 0) rotate(360deg); }
}
@keyframes moveParticles2 {
    0% { transform: translate(0, 0) rotate(20deg); }
    100% { transform: translate(0, 0) rotate(380deg); }
}
@keyframes moveParticles4 {
    0% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(-10px, 20px) rotate(180deg); }
    100% { transform: translate(0, 0) rotate(360deg); }
}
@keyframes gradientBorder {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.staking-plans { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 20px; }
.plan-card { background: rgba(0,0,0,0.4); border: 1px solid #333; border-radius: 10px; padding: 15px 5px; text-align: center; cursor: pointer; transition: 0.3s; display: flex; flex-direction: column; gap: 5px; position: relative; }
.plan-card:hover { border-color: var(--primary); }
.plan-card.selected { border-color: var(--primary); background: var(--primary-dim); box-shadow: inset 0 0 10px rgba(0,255,136,0.1); }
.plan-duration { font-size: 0.8rem; color: var(--text-muted); font-weight: 700; }
.plan-apy { font-size: 1.2rem; color: #fff; font-weight: 900; }

.staking-calculator { background: rgba(0,255,136,0.05); padding: 15px; border-radius: 10px; margin-top: 15px; display: flex; justify-content: space-between; align-items: center; border: 1px dashed var(--border); }
.calc-val { font-size: 1.2rem; color: var(--primary); font-weight: bold; font-family: monospace; }

.user-stakes-container { margin-top: 30px; border-top: 1px solid #333; padding-top: 20px; }
.stake-row { background: rgba(0,0,0,0.6); border: 1px solid #333; border-radius: 10px; padding: 15px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 10px; }
.stake-header { display: flex; justify-content: space-between; color: #fff; font-weight: bold; }
.stake-timer { font-family: monospace; color: var(--primary); }

.nft-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 25px; width: 100%; perspective: 1000px; }
.nft-card { background: rgba(10, 20, 15, 0.9); border: 1px solid var(--border); border-radius: 16px; padding: 15px; display: flex; flex-direction: column; align-items: center; transition: transform 0.4s ease, box-shadow 0.4s ease; transform-style: preserve-3d; }
@media (min-width: 769px) { .nft-card:hover { transform: translateY(-10px) rotateX(5deg) rotateY(2deg); box-shadow: 0 20px 40px rgba(0, 255, 136, 0.2); border-color: var(--primary); z-index: 10; } }
.nft-image-container { width: 100%; aspect-ratio: 1/1; background: #000; border-radius: 10px; overflow: hidden; margin-bottom: 12px; border: 1px solid #333; }
.nft-image { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s; }
.nft-card:hover .nft-image { transform: scale(1.1); }
.btn-mint-nft:disabled { border-color: #444; color: #555; background: transparent; box-shadow: none; cursor: not-allowed; }
.btn-mint-nft.owned { background: #111; border-color: #333; color: #fff; box-shadow: none; cursor: not-allowed; }

/* --- MOBILE ADAPTATION (FIXED) --- */
@media (max-width: 768px) {
    /* Делаем шапку вертикальной (2 этажа) */
    header { 
        flex-direction: column; 
        gap: 10px; 
        padding: 10px 15px; 
    }
    .brand {
        width: 100%;
        justify-content: center;
        margin-bottom: 5px;
    }
    
    /* Блок управления на всю ширину и распределен равномерно */
    .wallet-info { 
        width: 100%;
        justify-content: space-between;
        gap: 5px; 
    }
    
    /* Компактный монитор баланса */
    .wallet-monitor { 
        padding: 4px 8px; 
        margin: 0; 
        height: 36px;
        flex-grow: 1; /* Занимает доступное место */
        justify-content: space-around;
    }
    .balance-label { display: none; } /* Скрываем надписи TOKEN/ETH, оставляем только цифры */
    .balance-value { font-size: 0.8rem; }
    .balance-divider { height: 16px; margin: 0 8px; }
    
    /* Компактные кнопки */
    .network-select, .btn-connect { 
        padding: 6px 8px; 
        font-size: 0.75rem; 
        border-radius: 6px; 
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: auto;
    }
    .network-switcher { margin: 0; }

    main { padding: 20px 10px; gap: 20px; }
    .staking-plans { grid-template-columns: 1fr 1fr; gap: 8px; }
    .nft-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .nft-card { padding: 10px; }
    /* На мобильных устройствах кнопки могут быть широкими */
    .button-container {
        width: 100%;
    }
    .space-button { 
        font-size: 1rem; 
        padding: 15px 10px; 
        width: 100%;
    }
    .footer-socials { flex-direction: column; width: 100%; gap: 10px; }
    .social-btn { width: 100%; justify-content: center; }
}

/* --- MODAL --- */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.9); z-index: 2000; display: none; align-items: center; justify-content: center; backdrop-filter: blur(5px); }
.modal-content { background: #0a1f16; border: 1px solid var(--primary); padding: 30px; border-radius: 16px; width: 90%; max-width: 360px; text-align: center; }
.spinner { width: 40px; height: 40px; border: 4px solid rgba(0,255,136,0.1); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 15px; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-close { margin-top: 20px; padding: 8px 25px; background: transparent; border: 1px solid #555; color: #aaa; border-radius: 6px; cursor: pointer; }
.error-msg { color: var(--error); font-size: 0.85rem; margin-top: 10px; display: none; text-align: center; }

/* --- FOOTER --- */
footer { border-top: 1px solid #333; padding: 40px 20px; background: rgba(2, 4, 2, 0.95); margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 20px; }
.footer-socials { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; }
.social-btn { display: flex; align-items: center; gap: 10px; padding: 12px 25px; background: rgba(0, 255, 136, 0.05); border: 1px solid var(--primary); border-radius: 30px; color: var(--primary); text-decoration: none; font-weight: 700; font-size: 0.9rem; transition: 0.3s; text-transform: uppercase; }
.social-btn:hover { background: var(--primary); color: #000; box-shadow: 0 0 15px rgba(0, 255, 136, 0.6); transform: translateY(-3px); }
.footer-copy { color: var(--text-muted); font-size: 0.8rem; }
