:root {
    --primary: #FFB300;
    --primary-glow: rgba(255, 179, 0, 0.5);
    --bg-dark: #121212;
    --bg-panel: rgba(30, 30, 30, 0.6);
    --text-main: #ffffff;
    --text-muted: #aaaaaa;
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Poppins', sans-serif;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Fix: Main App Layout */
#app {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Background Blobs */
.bg-blob {
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    opacity: 0.4;
}
.blob-1 { top: -50px; left: -50px; background: purple; }
.blob-2 { bottom: -50px; right: -50px; background: orange; }

/* Header */
header {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
    flex-shrink: 0; /* Prevent header from shrinking */
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar-container {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #333;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--primary);
}

.avatar { width: 100%; height: 100%; object-fit: cover; }
.avatar-placeholder { font-weight: 800; color: var(--primary); }

.user-details { display: flex; flex-direction: column; }
#user-name { font-weight: 600; font-size: 0.9rem; }
.user-status { font-size: 0.7rem; color: var(--text-muted); }

.header-actions {
    display: flex;
    gap: 10px;
}

.token-display, .prize-display {
    background: rgba(255, 255, 255, 0.1);
    padding: 5px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 5px;
    border: 1px solid var(--glass-border);
    cursor: pointer;
}

.token-icon { font-size: 1.2rem; }
#token-count { font-weight: 800; color: var(--primary); }

/* Main Container */
#main-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.view {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    padding: 20px;
    padding-bottom: 80px; /* Space for nav */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    overflow-y: auto;
}

.view.active {
    opacity: 1;
    pointer-events: auto;
}

/* Home View (Game) */
.game-hero {
    height: 60%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.game-visual {
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, #2a2a2a 0%, transparent 70%);
    border-radius: 50%;
    position: relative;
    display: flex;
    justify-content: center;
}

/* Fishing Animation CSS */
.rod {
    width: 6px;
    height: 120px;
    background: linear-gradient(to right, #8B4513, #A0522D);
    border-radius: 3px;
    transform-origin: bottom center;
    transform: rotate(-45deg);
    transition: transform 0.5s;
    position: absolute;
    bottom: 50px;
    z-index: 2;
}

/* Rod Handle */
.rod::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: -2px;
    width: 10px;
    height: 30px;
    background: #333;
    border-radius: 5px;
}

/* Rod Guides */
.rod::before {
    content: '';
    position: absolute;
    top: 10px;
    left: -1px;
    width: 8px;
    height: 8px;
    border: 2px solid silver;
    border-radius: 50%;
}

.line {
    width: 1px;
    height: 0px;
    background: rgba(255, 255, 255, 0.6);
    position: absolute;
    top: 0;
    left: 3px;
    transform-origin: top center;
    transition: height 1s cubic-bezier(0.4, 0.0, 0.2, 1);
    z-index: 1;
}

.hook {
    font-size: 1.5rem;
    position: absolute;
    bottom: -20px;
    left: -10px;
    transition: bottom 0.5s;
}

.fish-visual {
    position: absolute;
    font-size: 2rem;
    opacity: 0;
    transform: scale(0);
    transition: all 0.5s ease;
    bottom: -50px;
    left: -20px;
}

.fish-caught {
    opacity: 1;
    transform: scale(1) translateY(-100px);
}

.bite-animation {
    animation: biteBob 0.5s ease-in-out infinite;
}

@keyframes biteBob {
    0%, 100% { transform: rotate(-45deg); }
    50% { transform: rotate(-40deg); }
}

.cast-animation {
    animation: castRod 2s ease-in-out infinite;
}

@keyframes castRod {
    0% { transform: rotate(-45deg); }
    50% { transform: rotate(0deg); }
    100% { transform: rotate(-45deg); }
}

.game-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.info-bubble {
    background: rgba(255, 255, 255, 0.1);
    padding: 5px 15px;
    border-radius: 15px;
    font-size: 0.8rem;
}

.btn-primary {
    background: linear-gradient(135deg, #FFB300, #FF8F00);
    border: none;
    padding: 15px 40px;
    border-radius: 30px;
    color: white;
    font-weight: 800;
    font-size: 1.2rem;
    box-shadow: 0 4px 15px var(--primary-glow);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.1s;
}

.btn-primary:active { transform: scale(0.95); }
.btn-primary:disabled { filter: grayscale(1); cursor: not-allowed; }

.status-text { min-height: 20px; color: var(--text-muted); font-size: 0.9rem; }

/* Inventory View */
.section-header h2 { font-size: 1.5rem; margin-bottom: 5px; }
.section-header p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 20px; }

.inventory-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    padding: 15px;
}

.inventory-item {
    display: flex;
    align-items: center;
    gap: 15px;
}

.item-icon { font-size: 2rem; background: rgba(255,255,255,0.05); padding: 10px; border-radius: 10px; }
.item-details h4 { font-size: 1rem; margin-bottom: 2px; }
.item-details p { font-size: 0.7rem; color: var(--text-muted); margin-bottom: 5px; }
.item-code {
    background: rgba(0,0,0,0.3);
    padding: 4px 8px;
    border-radius: 5px;
    font-family: monospace;
    color: var(--primary);
    cursor: pointer;
}

/* Wallet View */
.wallet-card {
    background: linear-gradient(135deg, #333, #111);
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    border: 1px solid var(--glass-border);
    margin-bottom: 30px;
}
.wallet-icon { font-size: 3rem; margin-bottom: 10px; }
.wallet-card h1 { font-size: 3rem; color: var(--primary); }
.wallet-actions { display: flex; flex-direction: column; gap: 10px; align-items: center; }

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    padding: 12px 25px;
    border-radius: 20px;
    color: white;
    font-weight: 600;
    width: 100%;
    cursor: pointer;
}

/* Leaderboard View */
.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.leaderboard-item {
    background: var(--bg-panel);
    padding: 10px 15px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.lb-rank {
    font-weight: 800;
    width: 25px;
    text-align: center;
    color: var(--text-muted);
}
.rank-1 { color: #FFD700; font-size: 1.2rem; }
.rank-2 { color: #C0C0C0; font-size: 1.1rem; }
.rank-3 { color: #CD7F32; font-size: 1.1rem; }

.lb-user {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.lb-avatar {
    width: 30px; height: 30px; border-radius: 50%; background: #444; overflow: hidden;
    display: flex; align-items: center; justify-content: center; font-size: 0.8rem;
}
.lb-avatar img { width: 100%; height: 100%; }

.lb-score { font-weight: 600; color: var(--primary); }


/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 20px;
    left: 20px; right: 20px;
    background: rgba(20, 20, 20, 0.9);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    height: 60px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    border: 1px solid var(--glass-border);
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0.5;
    transition: 0.2s;
    cursor: pointer;
}

.nav-item.active { opacity: 1; transform: scale(1.1); color: var(--primary); }
.nav-icon { font-size: 1.2rem; margin-bottom: 2px; }
.nav-item span { font-size: 0.6rem; font-weight: 600; }

/* Modals */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 200;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    width: 100%;
    max-width: 350px;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 10px;
}

.close-btn { font-size: 1.5rem; cursor: pointer; }

.input-wrapper {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
}

.btn-qty {
    width: 40px; height: 40px;
    border-radius: 10px; border: none; background: #444; color: white;
    font-size: 1.2rem; cursor: pointer;
}

#token-amount {
    width: 80px;
    background: transparent; border: 1px solid #555;
    color: white; text-align: center; border-radius: 10px;
    font-size: 1.2rem;
    -moz-appearance: textfield;
}

#token-amount::-webkit-outer-spin-button,
#token-amount::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.price-display {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px; font-weight: 600;
}

.price-value { color: var(--primary); font-size: 1.2rem; }

.full-width { width: 100%; margin-top: 10px; }

/* Win Panel */
.win-panel {
    text-align: center;
    border: 2px solid var(--primary);
    box-shadow: 0 0 30px var(--primary-glow);
}

.win-title { font-size: 2.5rem; color: var(--primary); margin-bottom: 10px; }
.prize-icon { font-size: 4rem; margin-bottom: 10px; animation: bounce 2s infinite; }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

.code-box {
    background: #000; padding: 10px; margin: 20px 0;
    border-radius: 10px; border: 1px dashed #555;
}

/* QR Modal */
.qr-container {
    background: white;
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
}

.qr-code-img {
    width: 200px;
    height: 200px;
    object-fit: contain;
}

.price-display-small {
    display: flex; justify-content: space-between;
    font-size: 0.9rem; margin-bottom: 15px;
    color: var(--text-muted);
}

/* Prize List Modal */
.prize-list-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.prize-list-item {
    background: rgba(255,255,255,0.05);
    padding: 10px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.prize-list-icon { font-size: 1.5rem; }
.prize-list-name { flex: 1; font-weight: 600; font-size: 0.9rem; }
.prize-list-prob { font-size: 0.8rem; color: var(--primary); }
