* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #4f46e5;
    --primary-dark: #3730a3;
    --bg: #f6f7fb;
    --card: #ffffff;
    --text: #111827;
    --muted: #6b7280;
    --border: #e5e7eb;
    --success: #16a34a;
}

body {
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.app {
    width: 100%;
    max-width: 520px;
    min-height: 100vh;
    margin: auto;
    background: var(--bg);
    overflow-x: hidden;
}

/* HEADER */

header {
    background: #ffffff;
    padding: 20px 22px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

header h1,
header h2 {
    font-size: 22px;
    font-weight: 800;
    color: #111827;
    letter-spacing: -0.4px;
}

header small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

/* MAIN */

main {
    padding: 18px;
    padding-bottom: 95px;
}

/* WALLET / BALANCE */

.balance-card {
    position: relative;
    overflow: hidden;
    padding: 25px;
    border-radius: 24px;
    color: white;
    background: linear-gradient(
        135deg,
        #4f46e5 0%,
        #6366f1 55%,
        #7c3aed 100%
    );
    box-shadow: 0 14px 35px rgba(79, 70, 229, 0.25);
    margin-bottom: 18px;
}

.balance-card::after {
    content: "";
    position: absolute;
    width: 170px;
    height: 170px;
    right: -70px;
    top: -70px;
    border-radius: 50%;
    background: rgba(255,255,255,0.10);
}

.balance-card small {
    position: relative;
    z-index: 1;
    font-size: 13px;
    font-weight: 600;
    opacity: .9;
}

.balance-card h1 {
    position: relative;
    z-index: 1;
    font-size: 38px;
    line-height: 1;
    margin-top: 12px;
    font-weight: 800;
    letter-spacing: -1px;
}

.balance-card p {
    position: relative;
    z-index: 1;
    margin-top: 8px;
    opacity: .8;
    font-size: 13px;
}

/* ACTION BUTTONS */

.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 25px;
}

.action-buttons button {
    border: none;
    border-radius: 15px;
    padding: 15px;
    background: white;
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 5px 18px rgba(15, 23, 42, .06);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: .2s;
}

.action-buttons button:hover {
    transform: translateY(-2px);
    border-color: #c7d2fe;
}

.action-buttons button:first-child {
    background: #eef2ff;
    color: var(--primary);
}

/* SECTION TITLE */

.section-title {
    font-size: 20px;
    font-weight: 800;
    margin: 5px 0 15px;
}

/* STAT CARDS */

.stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.stat-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px;
    min-height: 120px;
    box-shadow: 0 5px 18px rgba(15, 23, 42, .04);
}

.stat-card .icon {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    background: #eef2ff;
    color: var(--primary);
    font-size: 18px;
    margin-bottom: 12px;
}

.stat-card small {
    color: var(--muted);
    font-size: 12px;
}

.stat-card strong {
    display: block;
    margin-top: 4px;
    font-size: 20px;
    font-weight: 800;
}

/* CARDS */

.card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 6px 20px rgba(15, 23, 42, .05);
}

/* PAGE */

.page {
    padding: 20px 18px 100px;
}

.page h2 {
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 18px;
    letter-spacing: -.5px;
}

.page p {
    color: var(--muted);
    line-height: 1.6;
}

/* FARM */

.farm-card {
    background: white;
    border-radius: 22px;
    padding: 22px;
    border: 1px solid var(--border);
    box-shadow: 0 8px 25px rgba(15, 23, 42, .06);
}

.farm-card h2 {
    color: var(--text);
    margin-bottom: 8px;
}

.farm-balance {
    font-size: 32px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 18px;
}

.primary-button {
    width: 100%;
    border: none;
    border-radius: 15px;
    padding: 15px;
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: white;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(79,70,229,.25);
    transition: .2s;
}

.primary-button:active {
    transform: scale(.98);
}

/* TASKS */

.task-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px;
    margin-bottom: 12px;
}

.task-card h3 {
    font-size: 16px;
    margin-bottom: 5px;
}

.task-card p {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 14px;
}

.task-card button {
    width: 100%;
    border: none;
    border-radius: 12px;
    padding: 12px;
    background: #eef2ff;
    color: var(--primary);
    font-weight: 700;
}

/* REFERRAL */

.referral-box {
    background: white;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 20px;
}

.referral-link {
    margin: 15px 0;
    padding: 13px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 12px;
    color: #475569;
    font-size: 13px;
    word-break: break-all;
}

/* NAVIGATION */

nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: min(520px, 100%);
    height: 72px;
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(15px);
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    z-index: 1000;
    padding: 7px 5px;
}

nav button {
    border: none;
    background: transparent;
    color: #9ca3af;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 12px;
    transition: .2s;
}

nav button:hover {
    background: #f5f3ff;
}

nav button.active {
    color: var(--primary);
    background: #eef2ff;
}

nav button span,
nav button small {
    display: block;
    margin-top: 3px;
}

/* BACK BUTTON */

.back-button {
    border: none;
    background: #eef2ff;
    color: var(--primary);
    padding: 10px 15px;
    border-radius: 12px;
    font-weight: 700;
    margin-bottom: 18px;
}

/* REWARD POPUP */

.reward-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.58);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
    z-index: 99999;
    backdrop-filter: blur(7px);
}

.reward-box {
    width: min(350px,100%);
    background: white;
    border-radius: 26px;
    padding: 28px 22px 22px;
    text-align: center;
    box-shadow: 0 25px 70px rgba(0,0,0,.3);
    animation: rewardPop .25s ease-out;
}

.reward-icon {
    width: 64px;
    height: 64px;
    margin: auto;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eef2ff;
    font-size: 32px;
}

.reward-box h2 {
    margin-top: 15px;
    font-size: 23px;
    color: #111827;
}

.reward-subtitle {
    color: #6b7280;
    margin: 8px 0 18px;
}

.reward-amount {
    padding: 16px;
    border-radius: 16px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
    font-size: 27px;
    font-weight: 800;
}

.reward-added {
    color: #64748b;
    margin: 15px 0 20px;
    font-size: 13px;
}

.reward-box button {
    width: 100%;
    border: none;
    border-radius: 14px;
    padding: 14px;
    background: #111827;
    color: white;
    font-size: 15px;
    font-weight: 700;
}

@keyframes rewardPop {
    from {
        opacity: 0;
        transform: scale(.88) translateY(15px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* MOBILE */

@media (max-width: 380px) {
    main {
        padding: 14px;
    }

    .balance-card {
        padding: 21px;
    }

    .balance-card h1 {
        font-size: 33px;
    }
}