@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@700;800&display=swap');

:root{
    --primary:#6366f1;
    --primary-dark:#4338ca;

    --success:#10b981;
    --danger:#ef4444;
    --warning:#f59e0b;

    --text:#111827;
    --muted:#374151;

    --bg:#dbeafe;
    --card:#ffffff;

    --radius:16px;

    --shadow:
        0 10px 25px rgba(0,0,0,.08);
}

/* =========================
   BASE
========================= */

body{
    font-family:'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background:var(--bg);
    margin:0;
    padding:0;
    overflow-x:hidden;
    animation:fadeIn .3s ease;
    /* FIX: visibility:hidden removed — fadeIn animation handles appearance */
}
button{
    cursor:pointer;
    -webkit-tap-highlight-color: transparent;
}

button:disabled{
    opacity:0.6;
    cursor:not-allowed;
    transform:none !important;
    box-shadow:none !important;
}

*{
    box-sizing:border-box;
    transition:
        background .2s ease,
        box-shadow .2s ease,
        transform .15s ease;
}
.btn{
    padding:12px 16px;
    border:none;
    border-radius:12px;
    font-weight:600;
    cursor:pointer;
    transition:all .2s ease;
}

h2{
    font-size:20px;
    font-weight:700;
    letter-spacing:-0.3px;
}

h1, h2, h3 {
    letter-spacing: -0.3px;
}

p {
    line-height: 1.6;
}

button, a {
    font-family: inherit;
}





/* =========================
   MODERN NAVBAR
========================= */

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

    padding: 12px 18px;

    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    border-bottom: 1px solid rgba(255,255,255,0.3);

    box-shadow: 0 8px 30px rgba(0,0,0,.08);

    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar:hover{
    background: rgba(255,255,255,0.85);
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
}

.nav-title {
    font-weight: 700;
    font-size: 18px;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.nav-right a {
    text-decoration: none;
    color: #374151;
    font-weight: 500;
    font-size: 14px;
}

.nav-link:hover {
    color: #4f46e5;
}

.nav-btn {
    padding: 8px 14px;
    border-radius: 10px;

    background: linear-gradient(135deg,#6366f1,#4338ca);
    color: white !important;

    font-weight: 600;

    box-shadow: 0 6px 14px rgba(99,102,241,.3);
    transition: all .2s ease;
}

.nav-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(99,102,241,.4);
}

.nav-user {
    font-size: 13px;
    opacity: 0.8;
}

@media (max-width: 600px) {

    .navbar {
        display:flex;
        flex-direction:column;
        align-items:stretch;
        padding:12px 14px;
        gap:12px;
    }

    .nav-left {
        display:flex;
        align-items:center;
        justify-content:space-between;
        width:100%;
        gap:10px;
    }

    .nav-logo {
        width:34px;
        height:34px;
        border-radius:10px;
        flex-shrink:0;
    }

    .nav-title {
        font-size:15px;
        line-height:1.1;
        flex:1;
    }

    .nav-btn {
        padding:10px 14px;
        font-size:14px;
        border-radius:12px;
        white-space:nowrap;
        min-width:auto;
        box-shadow:0 6px 14px rgba(99,102,241,.25);
    }

    .nav-right {
        display:grid;
        grid-template-columns:repeat(4,1fr);
        gap:8px;
        width:100%;
    }

    .nav-right a,
    .nav-user {
        display:flex;
        align-items:center;
        justify-content:center;
        text-align:center;
        min-height:44px;
        padding:10px 8px;
        border-radius:12px;
        background:rgba(255,255,255,0.6);
        font-size:13px;
        font-weight:600;
        color:#374151;
    }

    .nav-user {
        font-size:12px;
    }
}

.app-header{
    background:white;
    box-shadow:0 6px 20px rgba(0,0,0,.08);
    padding:16px 0;
    border-bottom:1px solid #eee;
}

.header-inner{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:20px;
}

.nav{
    display:flex;
    align-items:center;
    gap:16px;
    flex-wrap:wrap;
}

.nav a{
    text-decoration:none;
    color:#333;
    font-weight:500;
}

/* =========================
   BUTTONS
========================= */



.add-toggle-btn{
    margin:20px 0;
    padding:12px 20px;

    background:linear-gradient(135deg,#6366f1,#4338ca);
    color:white;

    border:none;
    border-radius:14px;

    font-weight:600;
    font-size:15px;

    cursor:pointer;

    box-shadow:
        0 6px 14px rgba(0,0,0,.15),
        inset 0 -2px 4px rgba(0,0,0,.2);

    transition:all .2s ease;
}

.add-toggle-btn:hover{
    transform:translateY(-2px);
    box-shadow:0 10px 20px rgba(0,0,0,.2);
}



/* =========================
   CHILD CARDS
========================= */

.section-card{
    background:rgba(255,255,255,0.92);
    padding:24px;
    border-radius:22px;

    margin-bottom:30px;

    box-shadow:
        0 10px 25px rgba(0,0,0,.1),
        0 4px 10px rgba(0,0,0,.05);

    backdrop-filter: blur(6px);
    transition:all .2s ease;
}

.section-card:hover{
    box-shadow:
        0 30px 60px rgba(0,0,0,.12),
        0 10px 18px rgba(0,0,0,.08);
}

.card-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(260px,1fr));
    gap:16px;
    margin-bottom:10px;
}

.card{
    background:rgba(255,255,255,0.92);
    padding:18px;
    border-radius:18px;

    box-shadow:
        0 10px 25px rgba(0,0,0,.08),
        0 2px 6px rgba(0,0,0,.05);

    display:flex;
    flex-direction:column;
    gap:8px;
    justify-content:space-between;

    transition:all .25s cubic-bezier(.2,.8,.2,1);
}

.card form{
    width:100%;
}

.card .play-btn,
.card .add-reward-btn{
    width:100%;
}

.card .remove-btn{
    margin-top:6px;
}

.card:hover{
    transform:translateY(-4px) scale(1.01);
    box-shadow:
        0 18px 35px rgba(0,0,0,.12),
        0 6px 12px rgba(0,0,0,.08);
}

.card:active{
    transform:scale(.97);
}




.card strong{
    font-size:16px;
}

.card div{
    font-size:14px;
    color:#555;
}



.container{
    width:100%;
    max-width:100%;
    margin:auto;
    padding:10px;
    padding-bottom:80px;
}


/* =========================
   MODAL
========================= */

.modal{
    position:fixed;
    inset:0;
    background:rgba(0,0,0,.5);
    display:none; /* default hidden */
    justify-content:center;
    align-items:center;
    z-index:1000;
    pointer-events:none; /* prevent blocking when hidden */
}

.modal.hidden{
    display:none !important;
    pointer-events:none;
}

.modal.show{
    display:flex !important;
    pointer-events:auto;
}

.modal-content{
    background:white;
    padding:20px;
    border-radius:16px;
    width:90%;
    max-width:320px;
    display:flex;
    flex-direction:column;
    gap:12px;
    animation:fadeSlide .2s ease;
    pointer-events:auto;
}

.modal-content input{
    padding:12px;
    border-radius:10px;
    border:1px solid #ddd;
}

.remove-btn{
    margin-top:8px;
    background:none;
    border:none;
    color:#ef4444;
    font-size:13px;
    font-weight:600;
    padding:0;
    cursor:pointer;
    box-shadow:none;
    align-self:flex-start;
    transition:all .2s ease;
}

.remove-btn:hover{
    color:#dc2626;
    text-decoration:underline;
}

/* =========================
   LOGO
========================= */

.logo{
    display:flex;
    align-items:center;
    gap:10px;
    font-weight:700;
    font-size:18px;
}

.logo img{
    width:40px;
    height:40px;
    border-radius:12px;
    box-shadow:
        0 6px 14px rgba(0,0,0,.25),
        inset 0 2px 4px rgba(255,255,255,.3);
}



html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

@keyframes fadeSlide{
    from{
        opacity:0;
        transform:translateY(-10px);
    }
    to{
        opacity:1;
        transform:translateY(0);
    }
}

@keyframes pulseBtn{
    0%{ transform:scale(1); }
    50%{ transform:scale(1.06); }
    100%{ transform:scale(1); }
}

@keyframes rewardSuccess{
    0%{ box-shadow:0 0 0 rgba(16,185,129,0); }
    50%{ box-shadow:0 0 18px rgba(16,185,129,.7); }
    100%{ box-shadow:0 0 0 rgba(16,185,129,0); }
}

@keyframes fadeIn{
    from{ opacity:0; transform:translateY(5px); }
    to{ opacity:1; transform:translateY(0); }
}

@keyframes appFade{
    from{ opacity:0; transform:translateY(10px); }
    to{ opacity:1; transform:translateY(0); }
}

@keyframes pageIn{
    from{ opacity:0; transform:translateY(10px); }
    to{ opacity:1; transform:translateY(0); }
}

/* =========================
   FORM
========================= */

.add-form{
    display:flex;
    gap:10px;
    margin-bottom:20px;
}

.add-form input{
    flex:1;
    padding:10px;
    border-radius:8px;
    border:1px solid #ddd;
}

.add-form button{
    padding:10px 16px;
    border:none;
    border-radius:8px;
    background:#10b981;
    color:white;
}

.helper-text {
    font-size: 13px;
    color: #374151;
    opacity: 0.85;
    margin-bottom: 4px;
}

.helper-text strong {
    color: #4f46e5;
}

.empty-hint {
    font-size: 13px;
    color: #dc2626;
    font-weight: 600;
    margin-top: 6px;
}

.no-rewards {
    font-size: 14px;
    color: #991b1b;
    font-weight: 700;
    text-align: center;
    padding: 12px;
    background: #fee2e2;
    border-radius: 12px;
    border: 1px solid #fecaca;
}

@keyframes selectPop{
    0%{ transform:scale(1); }
    50%{ transform:scale(1.05); }
    100%{ transform:scale(1); }
}

@keyframes shake{
    0%{ transform:translateX(0); }
    25%{ transform:translateX(-3px); }
    50%{ transform:translateX(3px); }
    75%{ transform:translateX(-2px); }
    100%{ transform:translateX(0); }
}
.form-actions{
    margin-top:8px;
}


button:active{ transform:scale(.96); }



@keyframes pulseGlow{
    0%{ box-shadow:0 0 0 rgba(16,185,129,0); }
    50%{ box-shadow:0 0 16px rgba(16,185,129,.6); }
    100%{ box-shadow:0 0 0 rgba(16,185,129,0); }
}

.cta-btn {
    display: inline-block;
    margin-top: 12px;
    padding: 14px 22px;
    background: linear-gradient(135deg,#6366f1,#4338ca);
    color: white;
    border-radius: 14px;
    text-decoration: none;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(99,102,241,.35);
    transition: all .2s ease;
}

.cta-secondary {
    display: block;
    margin-top: 12px;
    font-size: 14px;
    color: #4f46e5;
}

.hidden{
    display:none;
}

.flex{
    display:flex;
}

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

.text-center{
    text-align:center;
}

button:focus-visible{
    outline:2px solid #6366f1;
    outline-offset:2px;
}

/* Improve touch feel */
button, .nav-item {
    touch-action: manipulation;
}

/* =========================
   TOAST
========================= */

.toast{
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #111827;
    color: white;
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: all .3s ease;
    cursor: default;
}

.toast.show{
    opacity: 1;
    transform: translate(-50%, -10px);
}

/* Clickable toast (used for update notification) */
.toast[style*="cursor: pointer"]{
    pointer-events: auto;
}


/* =========================
   BOTTOM NAV
========================= */

.bottom-nav{
    z-index: 900;
    position:fixed;
    bottom:0;
    left:0;
    right:0;
    background:linear-gradient(to top, rgba(255,255,255,0.95), rgba(255,255,255,0.8));
    backdrop-filter:blur(12px);
    display:flex;
    justify-content:space-around;
    padding:10px 0;
    box-shadow:0 -4px 20px rgba(0,0,0,.1);
}

.nav-item{
    display:flex;
    flex-direction:column;
    align-items:center;
    font-size:12px;
    color:#374151;
    text-decoration:none;
    gap:2px;
    padding:6px 10px;
    min-width:60px;
}

.nav-item span{ font-size:10px; }
.nav-item:active{ transform:scale(.92); }

.nav-item.active{
    color:#6366f1;
    font-weight:600;
}

.nav-item.active span{ font-weight:600; }

/* =========================
   PROGRESS BAR
========================= */

.progress-wrapper{
    width:90%;
    max-width:260px;
    margin:10px auto 20px auto;
    text-align:center;
}

.progress-bar{
    width:100%;
    height:14px;
    background:#e5e7eb;
    border-radius:999px;
    overflow:hidden;
    box-shadow:inset 0 2px 4px rgba(0,0,0,.1);
}

.progress-fill{
    height:100%;
    border-radius:999px;
    transition:width .4s ease;
}

.progress-text{
    margin-top:6px;
    font-size:13px;
    font-weight:600;
    color:#374151;
}

.danger-btn {
    background: #ef4444;
    color: white;
    padding: 10px 16px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
}

.cta-btn:hover { transform: translateY(-2px) scale(1.03); }



.cta-secondary:hover { text-decoration: underline; }

.append-reward-msg{
    margin-top:8px;
    color:#9ca3af;
    font-size:13px;
}

.header-token{
    width:18px;
    height:18px;
    border-radius:50%;
    box-shadow:
        0 3px 8px rgba(0,0,0,.3),
        0 0 8px rgba(0,0,0,.15);
}


/* =========================
   SCROLLBAR
========================= */

::-webkit-scrollbar{ width:8px; }
::-webkit-scrollbar-track{ background:#f1f5f9; }
::-webkit-scrollbar-thumb{
    background:linear-gradient(#6366f1,#4338ca);
    border-radius:10px;
}