@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Nunito:wght@700;800&display=swap');

:root {
    --bg-color: #E0F7FA;
    --primary-gradient: linear-gradient(180deg, #4FC3F7 0%, #039BE5 100%);
    --card-bg: #FFFFFF;
    --text-main: #37474F;
    --text-highlight: #FF6F00;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Nunito', sans-serif;
    background-color: var(--bg-color);
    /* Subtle geometric pattern */
    background-image:
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.8) 0%, transparent 10%),
        linear-gradient(45deg, #E1F5FE 25%, transparent 25%, transparent 75%, #E1F5FE 75%, #E1F5FE),
        linear-gradient(45deg, #E1F5FE 25%, transparent 25%, transparent 75%, #E1F5FE 75%, #E1F5FE);
    background-position: 0 0, 0 0, 20px 20px;
    background-size: 50px 50px, 40px 40px, 40px 40px;
    height: 100vh;
    display: flex;
    justify-content: center;
    overflow: hidden;
    user-select: none;
    /* Game feel */
}

/* APP FRAME */
.app-container {
    width: 100%;
    max-width: 480px;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.1);
    border-left: 1px solid rgba(255, 255, 255, 0.5);
    border-right: 1px solid rgba(255, 255, 255, 0.5);
}

/* --- HUD / TOP BAR --- */
.hud-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    padding-top: 20px;
    z-index: 20;
}

.resource-pill {
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    padding: 5px 15px;
    display: flex;
    align-items: center;
    color: white;
    font-family: 'Fredoka One', cursive;
    font-size: 14px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    position: relative;
    min-width: 80px;
}

.resource-icon {
    position: absolute;
    left: -10px;
    width: 32px;
    height: 32px;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3));
}

.resource-amount {
    margin-left: 20px;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
}

.btn-withdraw {
    background: linear-gradient(180deg, #66BB6A 0%, #2E7D32 100%);
    border: 2px solid #A5D6A7;
    border-radius: 50px;
    padding: 5px 15px;
    color: white;
    font-family: 'Fredoka One';
    font-size: 12px;
    margin-left: 5px;
    box-shadow: 0 4px 0 #1B5E20, 0 5px 10px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: transform 0.1s;
}

.btn-withdraw:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #1B5E20;
}

/* --- GAME BOARD --- */
.game-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    position: relative;
    margin-top: -20px;
}

.level-badge {
    background: linear-gradient(180deg, #AB47BC 0%, #7B1FA2 100%);
    color: white;
    padding: 8px 30px;
    border-radius: 20px;
    font-family: 'Fredoka One';
    border: 3px solid #E1BEE7;
    box-shadow: 0 6px 0 #4A148C;
    margin-bottom: 15px;
    font-size: 18px;
    position: relative;
    z-index: 15;
}

.board-frame {
    background: #9575CD;
    width: 95%;
    max-width: 380px;
    flex: 1;
    max-height: 55%;
    border-radius: 20px;
    border: 6px solid #D1C4E9;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.3), 0 10px 0 #512DA8;
    position: relative;
    /* Wooden/Floor texture behind tiles */
    background-image: repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.05) 0px, rgba(0, 0, 0, 0.05) 20px, transparent 20px, transparent 40px);
    overflow: hidden;
}

/* TILES 3D Style */
.tile-3d {
    width: 50px;
    height: 55px;
    /* Taller for 3D effect */
    background: linear-gradient(to bottom, #FFF 0%, #F5F5F5 100%);
    border-radius: 12px;
    position: absolute;
    box-shadow: 0 6px 0 #BDBDBD, 0 10px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: flex-start;
    /* Icon at top */
    justify-content: center;
    cursor: pointer;
    transition: transform 0.1s;
    z-index: 10;
    padding-top: 5px;
    box-sizing: border-box;
    border: 1px solid #FFF;
}

.tile-3d:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #BDBDBD;
}

.tile-content {
    font-size: 30px;
    filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.2));
}

/* --- INVENTORY SLOTS --- */
.inventory-container {
    width: 95%;
    max-width: 380px;
    height: 70px;
    margin-top: 20px;
    background: #546E7A;
    border-radius: 15px;
    border: 4px solid #37474F;
    box-shadow: 0 8px 0 #263238;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    gap: 5px;
}

.slot {
    width: 13%;
    height: 80%;
    background: #263238;
    border-radius: 8px;
    box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.5);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slot .tile-3d {
    position: relative;
    top: -2px;
    box-shadow: 0 4px 0 #9E9E9E;
    width: 90%;
    height: 90%;
    font-size: 24px;
}

/* --- POWER UPS --- */
.power-ups {
    display: flex;
    gap: 20px;
    margin-top: 25px;
}

.btn-power {
    width: 60px;
    height: 60px;
    border-radius: 20px;
    border: 3px solid #FFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
    cursor: pointer;
    position: relative;
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.2);
    transition: transform 0.1s;
}

.btn-power.blue {
    background: linear-gradient(180deg, #42A5F5 0%, #1976D2 100%);
    border-color: #BBDEFB;
    box-shadow: 0 6px 0 #0D47A1;
}

.btn-power.purple {
    background: linear-gradient(180deg, #AB47BC 0%, #7B1FA2 100%);
    border-color: #E1BEE7;
    box-shadow: 0 6px 0 #4A148C;
}

.btn-power:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 !important;
}

/* MODALS */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.victory-card {
    background: radial-gradient(circle, #FFF8E1 20%, #FFECB3 100%);
    width: 85%;
    max-width: 350px;
    border-radius: 30px;
    border: 6px solid #FFD54F;
    text-align: center;
    padding: 30px 20px;
    box-shadow: 0 0 50px rgba(255, 193, 7, 0.6);
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.btn-claim {
    background: linear-gradient(180deg, #76FF03 0%, #43A047 100%);
    width: 90%;
    padding: 15px;
    border-radius: 50px;
    border: none;
    font-family: 'Fredoka One';
    font-size: 22px;
    color: #1B5E20;
    margin-top: 20px;
    box-shadow: 0 6px 0 #33691E, 0 10px 20px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: transform 0.1s;
    text-transform: uppercase;
}

.btn-claim:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #33691E;
}

.btn-watch-ad {
    background: linear-gradient(180deg, #FF5252 0%, #D32F2F 100%);
    /* ... similar style ... */
}

/* --- LOGIN / REGISTER PAGES --- */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    padding: 20px;
    box-sizing: border-box;
}

.auth-card {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1), 0 0 0 5px rgba(255, 255, 255, 0.4);
    width: 100%;
    max-width: 350px;
    text-align: center;
    animation: slideUp 0.5s ease-out;
    border: 3px solid #E1F5FE;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.auth-title {
    font-family: 'Fredoka One';
    font-size: 32px;
    color: #0288D1;
    margin-bottom: 20px;
    text-shadow: 2px 2px 0 #E1F5FE;
}

.game-input {
    width: 100%;
    padding: 15px;
    margin-bottom: 15px;
    border: 3px solid #B3E5FC;
    border-radius: 15px;
    background: #F1F8E9;
    font-family: 'Nunito', sans-serif;
    font-weight: bold;
    font-size: 16px;
    box-sizing: border-box;
    /* Fix padding issue */
    outline: none;
    color: #455A64;
    transition: all 0.2s;
}

.game-input:focus {
    border-color: #29B6F6;
    background: #FFF;
    box-shadow: 0 0 0 4px rgba(41, 182, 246, 0.2);
}

.btn-auth {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 50px;
    background: linear-gradient(180deg, #29B6F6 0%, #0288D1 100%);
    color: white;
    font-family: 'Fredoka One';
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 5px 0 #01579B, 0 10px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.1s;
    margin-top: 10px;
}

.btn-auth:active {
    transform: translateY(4px);
    box-shadow: 0 1px 0 #01579B;
}

.btn-secondary {
    background: linear-gradient(180deg, #FF7043 0%, #E64A19 100%);
    box-shadow: 0 5px 0 #BF360C, 0 10px 20px rgba(0, 0, 0, 0.1);
}

.btn-secondary:active {
    box-shadow: 0 1px 0 #BF360C;
}

.auth-footer {
    margin-top: 25px;
    font-size: 14px;
    color: #78909C;
}

.auth-footer a {
    color: #039BE5;
    text-decoration: none;
    font-weight: 800;
}

.auth-footer a:hover {
    text-decoration: underline;
}