:root {
    --lona-primary: #1A4D2E;
    --lona-accent: #FF9F1C;
    --lona-bg: #FFFFFF;
}

#lonabon-app {
    max-width: 500px; margin: 30px auto;
    background: var(--lona-bg); border-radius: 20px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.1);
    font-family: 'Segoe UI', sans-serif; overflow: hidden;
    position: relative; border: 1px solid #f0f0f0;
    touch-action: pan-y; 
    -webkit-tap-highlight-color: transparent;
}

/* --- HEADER --- */
.lona-header { background: var(--lona-primary); padding: 18px 25px; color: white; position: relative; z-index: 10; }
.header-row { display: flex; justify-content: space-between; align-items: center; }
.order-id { font-weight: 800; font-size: 1.1rem; }
.live-badge { background: rgba(255,255,255,0.2); padding: 4px 10px; border-radius: 15px; font-size: 0.75rem; display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; background: #ff5252; border-radius: 50%; animation: pulse 1s infinite; }
.header-items { font-size: 0.85rem; opacity: 0.9; margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- TIMER --- */
.lona-timer-wrap { text-align: center; padding: 15px; border-bottom: 1px dashed #eee; background: #fdfdfd; position: relative; z-index: 5; }
.lona-timer-wrap h1 { margin: 0; color: var(--lona-primary); font-size: 2rem; font-weight: 800; }
.lona-timer-wrap small { text-transform: uppercase; color: #888; font-size: 0.7rem; font-weight: 700; }
.lona-timer-wrap.completed h1 { color: #27ae60; font-size: 1.5rem; }

/* --- TIMELINE --- */
.lona-stage { padding: 40px 10px; position: relative; z-index: 5; }
.lona-steps { display: flex; justify-content: space-between; position: relative; z-index: 2; }
.lona-steps::before { content: ''; position: absolute; top: 18px; left: 5%; right: 5%; height: 2px; background: #eee; z-index: -1; }

.step { text-align: center; width: 16%; opacity: 0.3; transition: 0.4s; }
.icon {
    width: 36px; height: 36px; background: #fff; border: 2px solid #eee; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 6px; font-size: 0.9rem; color: #bbb; transition: 0.3s;
}
.step span { font-size: 0.65rem; font-weight: 700; color: #444; display: block; }
.step.active { opacity: 1; }
.step.active .icon { background: var(--lona-primary); border-color: var(--lona-primary); color: #fff; box-shadow: 0 4px 10px rgba(26, 77, 46, 0.2); }

/* --- FX LAYER --- */
.lona-fx { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.fx-bike { position: absolute; top: 35%; left: -50px; font-size: 2rem; color: var(--lona-accent); opacity: 0; }
.fx-bike.active { opacity: 1; animation: ride 5s linear infinite; }
.fx-smoke { display: none; position: absolute; left: 50%; top: 15%; transform: translateX(-50%); gap: 4px; }
.fx-smoke.active { display: flex; }
.fx-smoke span { width: 5px; height: 15px; background: #bbb; border-radius: 10px; animation: smoke 1.5s infinite; filter: blur(2px); }

/* --- STATUS TEXT --- */
.lona-msg { text-align: center; padding-bottom: 25px; position: relative; z-index: 5; }
.lona-msg h2 { color: var(--lona-primary); margin: 0; font-size: 1.5rem; }
.lona-success-msg { padding: 20px; background: #f0f9f4; border-radius: 10px; margin: 10px 20px 20px; border: 1px solid #ccece0; }
.pulse-bar { width: 40px; height: 3px; background: var(--lona-accent); margin: 8px auto; border-radius: 2px; animation: widthPulse 1.5s infinite; }

/* --- ACTIONS --- */
.lona-actions { display: none; padding: 0 20px 30px; text-align: center; position: relative; z-index: 20; }
.lona-actions.visible { display: block; animation: slideUp 0.5s; }
.btn-lona { display: block; padding: 12px; border-radius: 8px; text-decoration: none; font-weight: 700; margin-top: 10px; cursor: pointer; border:none; width: 100%; }
.btn-lona.solid { background: var(--lona-primary); color: #fff; }
.btn-lona.outline { background: transparent; border: 2px solid #fff; color: #fff; }

/* =========================================
   🔥 FIXED GAME UI
   ========================================= */

#lona-game-layer { 
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; 
    z-index: 50; pointer-events: none; overflow: hidden; touch-action: none; 
}

/* 1. FLOATING START BUTTON (Perfectly Centered on Mobile) */
.floating-game-btn { 
    position: absolute; bottom: 20px; 
    left: 50%; transform: translateX(-50%); /* Centering magic */
    z-index: 60; pointer-events: auto !important;
    background: var(--lona-accent); color: #fff; border: none; 
    padding: 12px 30px; border-radius: 50px; font-weight: bold; 
    cursor: pointer; box-shadow: 0 4px 15px rgba(255,159,28,0.5); 
    transition: 0.2s; font-size: 1.1rem; 
    display: flex; align-items: center; justify-content: center; gap: 8px;
    white-space: nowrap; width: auto; max-width: 90%;
    animation: floatBtn 3s ease-in-out infinite;
}
.floating-game-btn:hover { transform: translateX(-50%) scale(1.05); }

/* 2. OVERLAY (Solid Background) */
#lonabon-app #lona-tutorial-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    width: 100%; height: 100%;
    background: rgba(26, 77, 46, 0.98) !important; 
    backdrop-filter: blur(5px);
    z-index: 999 !important; display: none;
    flex-direction: column; align-items: center; justify-content: center;
    padding: 20px; pointer-events: auto !important;
}
#lona-tutorial-overlay .tut-content { position: relative; z-index: 1000; width: 100%; text-align: center; }
#lona-tutorial-overlay h2 { color: #FF9F1C !important; margin-top: 0; font-size: 2rem; margin-bottom: 10px; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
#lona-tutorial-overlay p { margin-bottom: 25px; line-height: 1.6; font-size: 1.1rem; color: #ffffff !important; }
#lona-tutorial-overlay .btn-lona { width: auto; padding: 12px 35px; font-size: 1.2rem; display: inline-block; background: #FF9F1C; color: #fff; }

/* 3. HUD - RED BAR FIX */
.game-hud { 
    position: absolute; top: 0; left: 0; width: 100%; 
    display: flex; justify-content: space-between; align-items: flex-start;
    padding: 10px 15px; 
    pointer-events: none; z-index: 80; 
    background: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent); 
    box-sizing: border-box;
}

.hud-left { display: flex; flex-direction: column; gap: 5px; }
.hud-right { display: flex; gap: 10px; align-items: center; }

.hud-item { 
    background: rgba(255,255,255,0.2); color: #fff; 
    padding: 4px 10px; border-radius: 12px; font-weight: bold; font-size: 0.85rem;
    backdrop-filter: blur(2px); border: 1px solid rgba(255,255,255,0.1);
}

/* 🔥 THE FIX: Strictly size the Quit button */
.hud-btn-small { 
    pointer-events: auto !important; 
    background: #e74c3c; color: white; border: none; border-radius: 8px; 
    cursor: pointer; 
    width: 32px !important; height: 32px !important; 
    min-width: 32px !important; max-width: 32px !important;
    flex: 0 0 32px !important; /* Forces it not to grow/shrink */
    display: flex; align-items: center; justify-content: center; 
    font-size: 1rem; padding: 0 !important; margin: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

/* 4. GAME OBJECTS */
.chop-item { 
    position: absolute; font-size: 3.5rem; cursor: pointer; 
    pointer-events: auto; z-index: 70; 
    touch-action: manipulation; user-select: none;
    animation: floatUpVeggie 3s linear forwards;
}

/* 5. SLASH & COMBO */
.slash-line {
    position: absolute; width: 80px; height: 4px;
    background: #fff; border-radius: 2px;
    box-shadow: 0 0 8px #fff, 0 0 15px #FF9F1C;
    pointer-events: none; z-index: 85;
    opacity: 0.9;
}
.combo-text {
    position: absolute; font-size: 1.5rem; font-weight: 800; color: #ffeb3b; 
    text-shadow: 2px 2px 0 #d35400; pointer-events: none; z-index: 90;
    animation: popCombo 0.5s ease-out forwards;
}

/* 6. GAME OVER */
#game-over-screen { 
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.95); z-index: 999; 
    display: flex; flex-direction: column; align-items: center; justify-content: center; 
    color: #fff; pointer-events: auto; display: none;
}
.reward-box { background: rgba(255,255,255,0.1); padding: 15px; border-radius: 10px; margin: 15px 0; text-align: center; width: 80%; }
.game-actions { display: flex; gap: 10px; width: 80%; justify-content: center; }

/* Animations */
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }
@keyframes pulseIcon { 0% { transform: scale(1); } 50% { transform: scale(1.1); } 100% { transform: scale(1); } }
@keyframes chop { 0% { transform: rotate(0deg); } 50% { transform: rotate(-20deg); } 100% { transform: rotate(0deg); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes pop { 0% { transform: scale(0.5); } 80% { transform: scale(1.2); } 100% { transform: scale(1); } }
@keyframes smoke { 0% { opacity:0; transform:translateY(0); } 50% { opacity:0.7; } 100% { opacity:0; transform:translateY(-15px); } }
@keyframes ride { 0% { left: -10%; } 100% { left: 110%; } }
@keyframes slideIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes widthPulse { 0%, 100% { width: 40px; opacity: 0.5; } 50% { width: 70px; opacity: 1; } }
@keyframes pulseSlow { 0%,100% { transform: translateX(-50%) scale(1); } 50% { transform: translateX(-50%) scale(1.05); } }
@keyframes floatBtn { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes floatUpVeggie { 0% { transform: translateY(100%) rotate(0deg); opacity: 1; } 100% { transform: translateY(-120%) rotate(360deg); opacity: 0; } }
@keyframes popCombo { 0% { transform: scale(0.5); opacity: 0; } 50% { transform: scale(1.2); opacity: 1; } 100% { transform: scale(1); opacity: 0; top: -50px; } }

/* Mobile Optimizations */
@media(max-width: 600px) {
    #lonabon-app { margin: 10px auto; border-radius: 0; border: none; box-shadow: none; max-width: 100%; }
    .step span { display: none; }
    .icon { width: 30px; height: 30px; font-size: 0.8rem; }
    .chop-item { font-size: 3rem; }
    
    /* Mobile HUD */
    .game-hud { padding: 8px 10px; }
    .hud-item { font-size: 0.75rem; padding: 3px 8px; }
}

/* Dashboard Styles */
.lona-dashboard-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
.lona-wallet-card, .lona-leaderboard-card, .lona-coupons-list { background: #f9f9f9; padding: 20px; border-radius: 10px; border: 1px solid #eee; }
.lona-coupons-list { grid-column: span 2; }
.lona-balance { font-size: 1.5rem; display: flex; align-items: center; gap: 10px; margin: 15px 0; }
.lona-balance .points { font-weight: bold; color: #d35400; }
.lona-balance .money { font-weight: bold; color: #27ae60; }
@media(max-width: 600px) {
    .lona-dashboard-wrap { grid-template-columns: 1fr; }
    .lona-coupons-list { grid-column: span 1; }
}