/* ==============================================================================
   MUKBILL COZY CARTOON UI STYLESHEET
   Adheres to Visual Asset Bible & Android WebView Dropdown Safety Guidelines.
   ============================================================================== */

@font-face {
    font-family: 'Fredoka';
    src: url('../assets/fonts/Fredoka-Bold.ttf') format('truetype');
    font-weight: bold;
    font-display: swap;
}

@font-face {
    font-family: 'Coiny';
    src: url('../assets/fonts/Coiny.ttf') format('truetype');
    font-weight: normal;
    font-display: swap;
}

:root {
    --color-cheese: #F59E0B;
    --color-cheese-light: #FEF3C7;
    --color-spicy: #EF4444;
    --color-spicy-dark: #B91C1C;
    --color-live: #8B5CF6;
    --color-mint: #10B981;
    --color-sky: #BAE6FD;
    --color-wood: #D97706;
    --color-wood-dark: #78350F;
    --font-primary: 'Fredoka', 'Coiny', -apple-system, BlinkMacSystemFont, "Segoe UI", "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}

.hud-icon-img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    vertical-align: middle;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.inline-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    vertical-align: -2px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #0F172A;
    font-family: var(--font-primary);
    touch-action: manipulation;
}

/* Ambient Studio Desktop Background */
.desktop-viewport-wrapper {
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #1E1B4B 0%, #09090B 100%);
}

/* 9:16 Portrait Mobile Shell Container */
#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 480px;
    max-height: 960px;
    background: #BAE6FD;
    overflow: hidden;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
}

@media (min-width: 481px) {
    #game-container {
        border-radius: 28px;
        border: 4px solid #334155;
    }
}

/* 2.5D Isometric Diorama Canvas */
#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    cursor: pointer;
}

/* ==============================================================================
   TOP STATUS HUD (Level, Cash, Hearts, Gems, Settings)
   ============================================================================== */
#hud-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    padding: env(safe-area-inset-top, 12px) 12px 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.65) 0%, rgba(15, 23, 42, 0) 100%);
    pointer-events: none;
}

.hud-left, .hud-center, .hud-right {
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
}

.hud-pill {
    background: rgba(255, 255, 255, 0.92);
    border: 2px solid var(--color-wood-dark);
    border-radius: 20px;
    padding: 4px 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    font-weight: bold;
    color: var(--color-dark);
}

.hud-level-pill {
    background: linear-gradient(135deg, var(--color-cheese) 0%, #D97706 100%);
    color: #FFF;
    border-color: #78350F;
}

.hud-progress-bar {
    position: absolute;
    top: 52px;
    left: 14px;
    width: 100px;
    height: 6px;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 4px;
    overflow: hidden;
    pointer-events: none;
}

#hud-progress-fill {
    width: 35%;
    height: 100%;
    background: linear-gradient(90deg, #F59E0B, #EC4899);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.hud-btn {
    background: #FFF;
    border: 2px solid var(--color-wood-dark);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transition: transform 0.1s ease;
}

.hud-btn:active {
    transform: scale(0.92);
}

/* ==============================================================================
   LIVE CHAT FEED OVERLAY (Simulated Viewers)
   ============================================================================== */
#live-chat-panel {
    position: absolute;
    left: 12px;
    top: 75px;
    width: 240px;
    max-height: 140px;
    z-index: 5;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#live-chat-messages {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: hidden;
}

.chat-msg {
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: #FFF;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    line-height: 1.3;
    animation: chatSlideIn 0.25s ease-out;
    border-left: 3px solid var(--color-cheese);
}

.chat-highlight {
    border-left-color: #EC4899;
    background: rgba(236, 72, 153, 0.35);
}

.chat-user {
    font-weight: bold;
}

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

/* ==============================================================================
   ACTION BUTTONS: GO LIVE! & QUICK UPGRADE
   ============================================================================== */
#action-controls {
    position: absolute;
    bottom: 80px;
    left: 12px;
    right: 12px;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    pointer-events: none;
}

.action-btn {
    pointer-events: auto;
    cursor: pointer;
    border: none;
    font-family: var(--font-primary);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3);
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.action-btn:active {
    transform: scale(0.94);
}

/* Big GO LIVE! 🔴 Button */
#btn-go-live {
    background: linear-gradient(135deg, #EF4444 0%, #B91C1C 100%);
    border: 3px solid #FFF;
    border-radius: 26px;
    padding: 12px 24px;
    color: #FFF;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: hidden;
    animation: livePulse 2s infinite;
}

#btn-go-live.live-active {
    background: linear-gradient(135deg, #8B5CF6 0%, #6D28D9 100%);
    animation: liveHypePulse 0.8s infinite alternate;
}

#go-live-timer {
    font-size: 12px;
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 2px;
}

@keyframes livePulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    50% { transform: scale(1.03); box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
}

@keyframes liveHypePulse {
    0% { transform: scale(1); filter: brightness(1.0); }
    100% { transform: scale(1.05); filter: brightness(1.2); }
}

/* Quick Kitchen Upgrade Button */
#btn-quick-kitchen {
    background: linear-gradient(135deg, #10B981 0%, #047857 100%);
    border: 3px solid #FFF;
    border-radius: 20px;
    padding: 10px 16px;
    color: #FFF;
    font-size: 13px;
    font-weight: bold;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#btn-quick-kitchen:disabled {
    background: #94A3B8;
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Hype Gauge Bar */
#hype-gauge {
    position: absolute;
    bottom: 155px;
    right: 14px;
    width: 140px;
    height: 10px;
    background: rgba(15, 23, 42, 0.6);
    border-radius: 8px;
    border: 2px solid #FFF;
    overflow: hidden;
    z-index: 10;
}

#hype-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #F59E0B, #EF4444);
    transition: width 0.2s ease;
}

/* ==============================================================================
   BOTTOM NAVIGATION BAR
   ============================================================================== */
#bottom-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: rgba(255, 255, 255, 0.95);
    border-top: 3px solid var(--color-wood-dark);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom, 8px);
    z-index: 20;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.1);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: none;
    border: none;
    font-family: var(--font-primary);
    font-size: 11px;
    font-weight: bold;
    color: var(--color-dark);
    cursor: pointer;
    transition: transform 0.15s ease;
}

.nav-item:active {
    transform: scale(0.9);
}

.nav-icon {
    font-size: 22px;
    margin-bottom: 2px;
}

/* ==============================================================================
   MODAL OVERLAYS (Kitchen, Guests, Quests, Shop, Offline Welcome)
   ============================================================================== */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 50;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 16px;
}

.modal-overlay.active {
    display: flex;
    animation: modalFadeIn 0.2s ease;
}

.modal-dialog {
    background: #FFF;
    border: 4px solid var(--color-wood-dark);
    border-radius: 24px;
    width: 100%;
    max-width: 420px;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.4);
}

.modal-header {
    background: var(--color-cheese-light);
    border-bottom: 3px solid var(--color-wood-dark);
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 17px;
    font-weight: bold;
    color: var(--color-wood-dark);
}

.modal-close {
    background: #EF4444;
    color: #FFF;
    border: 2px solid var(--color-wood-dark);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-weight: bold;
    cursor: pointer;
}

.modal-body {
    padding: 14px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Card Items in Modals */
.recipe-item, .guest-card, .quest-card, .shop-card {
    background: #F8FAFC;
    border: 2px solid #E2E8F0;
    border-radius: 16px;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.recipe-thumb, .guest-thumb, .shop-thumb {
    width: 54px;
    height: 54px;
    object-fit: contain;
    flex-shrink: 0;
}

.recipe-info, .guest-info, .quest-info, .shop-info {
    flex: 1;
}

.recipe-title, .guest-name, .quest-title, .shop-title {
    font-size: 14px;
    font-weight: bold;
    color: var(--color-dark);
}

.recipe-desc, .guest-quote, .quest-desc, .shop-desc {
    font-size: 11px;
    color: #64748B;
    margin-top: 2px;
}

.recipe-meta, .guest-multiplier, .quest-meta, .shop-cost {
    font-size: 12px;
    font-weight: bold;
    color: var(--color-cheese);
    margin-top: 4px;
}

.quest-progress-bar {
    width: 100%;
    height: 6px;
    background: #E2E8F0;
    border-radius: 3px;
    margin-top: 4px;
    overflow: hidden;
}

.quest-progress-bar .fill {
    height: 100%;
    background: #10B981;
}

.quest-claim-btn, .shop-buy-btn {
    background: #10B981;
    color: #FFF;
    border: 2px solid var(--color-wood-dark);
    border-radius: 14px;
    padding: 8px 14px;
    font-family: var(--font-primary);
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
}

.btn-disabled {
    background: #94A3B8 !important;
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-vip {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
}

.vip-icon {
    font-size: 32px;
    margin-right: 6px;
}

/* ==============================================================================
   FLOATING FX PARTICLES
   ============================================================================== */
#fx-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 40;
    overflow: hidden;
}

.fx-coin-item, .fx-heart-item {
    position: absolute;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
    animation: fxFloatUp 1.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.fx-coin-item {
    color: #FBBF24;
}

.fx-heart-item {
    color: #EC4899;
}

.fx-toast {
    position: absolute;
    top: 22%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.85);
    border: 2px solid #FFF;
    border-radius: 20px;
    padding: 8px 20px;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    animation: fxToastAnim 1.8s ease forwards;
}

@keyframes fxFloatUp {
    0% { opacity: 1; transform: translate(-50%, 0) scale(0.8); }
    50% { transform: translate(-50%, -40px) scale(1.2); }
    100% { opacity: 0; transform: translate(-50%, -80px) scale(1); }
}

@keyframes fxToastAnim {
    0% { opacity: 0; transform: translate(-50%, 20px) scale(0.9); }
    15% { opacity: 1; transform: translate(-50%, 0) scale(1.05); }
    80% { opacity: 1; transform: translate(-50%, 0) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -20px) scale(0.9); }
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}
