/* ========================================
   Tower Legend - Warm Jungle Theme
   Deep Greens + Gold + Amber
   ======================================== */

:root {
    /* Warm Jungle Color System */
    --bg-primary: #0c110a;
    --bg-secondary: #141c12;
    --bg-tertiary: #1a2416;
    --bg-card: #1e2a1a;
    --bg-card-hover: #263322;
    
    /* Jungle Greens (warmer) */
    --jungle-green: #2ee67a;
    --jungle-green-dark: #1ab05c;
    --jungle-green-dim: #1a4d2d;
    --jungle-moss: #5cdb7f;
    --jungle-olive: #4a6741;
    
    /* Gold & Amber */
    --gold: #e8b230;
    --gold-light: #f5cc50;
    --gold-dim: #6b5219;
    --amber: #d4910a;
    --amber-glow: rgba(232, 178, 48, 0.3);
    
    /* Other */
    --accent-red: #e05252;
    --accent-red-light: #f07070;
    --accent-red-dim: #6b2222;
    
    /* Neon Glows */
    --glow-green: 0 0 15px rgba(46, 230, 122, 0.3), 0 0 35px rgba(46, 230, 122, 0.12);
    --glow-red: 0 0 15px rgba(224, 82, 82, 0.4), 0 0 35px rgba(224, 82, 82, 0.15);
    --glow-gold: 0 0 15px rgba(232, 178, 48, 0.35), 0 0 35px rgba(232, 178, 48, 0.12);
    
    /* Typography */
    --font-display: 'Orbitron', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
}

/* Reset */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; }

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: #d8e0cc;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ========================================
   Jungle Background Layers
   ======================================== */
.jungle-bg {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: url('images/bg-jungle.png') center center / cover no-repeat;
    opacity: 0.45;
    z-index: 0;
}

.jungle-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: 
        radial-gradient(ellipse at 30% 40%, rgba(46, 230, 122, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, rgba(232, 178, 48, 0.02) 0%, transparent 50%),
        radial-gradient(ellipse at center, transparent 25%, rgba(12, 17, 10, 0.8) 100%);
    z-index: 0;
}

.leaves-left {
    position: fixed;
    left: 0; top: 0;
    width: 220px; height: 100%;
    background: url('images/leaves-border.png') left top / contain no-repeat;
    opacity: 0.55;
    z-index: 1;
    pointer-events: none;
}

.leaves-right {
    position: fixed;
    right: 0; top: 0;
    width: 220px; height: 100%;
    background: url('images/leaves-border.png') right top / contain no-repeat;
    opacity: 0.45;
    z-index: 1;
    pointer-events: none;
    transform: scaleX(-1);
}

.particles-container {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* ========================================
   Game Wrapper
   ======================================== */
.game-wrapper {
    position: relative;
    z-index: 2;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========================================
   Header
   ======================================== */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    margin-bottom: 0.75rem;
    background: rgba(14, 20, 12, 0.6);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(8px);
}

.header-tabs {
    display: flex;
    background: rgba(20, 28, 18, 0.8);
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.tab-btn {
    padding: 0.5rem 1.5rem;
    background: transparent;
    border: none;
    color: #7a8c6e;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.tab-btn.active {
    background: var(--bg-tertiary);
    color: #d8e0cc;
}

.tab-btn:hover { color: #d8e0cc; }

.header-center { display: flex; align-items: center; }

.recent-multipliers { display: flex; gap: 0.5rem; }

.mult-badge {
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 700;
}

.mult-badge.green { background: var(--jungle-green); color: #0a1a0d; }
.mult-badge.gray { background: #374031; color: #7a8c6e; }
.mult-badge.red { background: var(--accent-red); color: #fff; }

.header-right { display: flex; align-items: center; gap: 1rem; }

.provably-fair-badge {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(20, 28, 18, 0.8);
    border: 1px solid rgba(46, 230, 122, 0.15);
    border-radius: var(--radius-sm);
    color: var(--jungle-green);
    cursor: pointer;
    transition: var(--transition-normal);
}

.provably-fair-badge:hover { box-shadow: var(--glow-green); }

.balance-display {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(20, 28, 18, 0.8);
    border: 1px solid rgba(232, 178, 48, 0.15);
    border-radius: var(--radius-sm);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gold-light);
}

.balance-display i { color: var(--gold); }
.balance-display .currency { font-size: 0.65rem; color: #7a8c6e; }

/* ========================================
   Game Body
   ======================================== */
.game-body {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1rem;
    flex: 1;
    align-items: start;
}

/* ========================================
   Control Panel (Left)
   ======================================== */
.control-panel {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-section {
    background: rgba(20, 28, 18, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    padding: 1rem;
    backdrop-filter: blur(6px);
}

.control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.control-label { font-size: 0.8rem; font-weight: 500; color: #7a8c6e; }
.control-label i { margin-left: 4px; font-size: 0.7rem; }
.usdt-equiv { font-size: 0.75rem; color: #7a8c6e; }

/* Bet Input */
.bet-input-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.bet-input-wrapper { flex: 1; position: relative; }

.bet-input-wrapper .currency-icon {
    position: absolute;
    left: 10px; top: 50%;
    transform: translateY(-50%);
    color: var(--gold);
    font-weight: 700;
    font-size: 0.9rem;
}

.bet-input-wrapper input {
    width: 100%; height: 40px;
    padding: 0 0.75rem 0 1.75rem;
    background: rgba(12, 17, 10, 0.8);
    border: 1px solid rgba(74, 103, 65, 0.3);
    border-radius: var(--radius-sm);
    color: #d8e0cc;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    outline: none;
    transition: var(--transition-fast);
}

.bet-input-wrapper input:focus {
    border-color: var(--jungle-green);
    box-shadow: 0 0 0 2px rgba(46, 230, 122, 0.1);
}

.bet-adjust {
    height: 40px;
    padding: 0 0.7rem;
    border: 1px solid rgba(74, 103, 65, 0.3);
    background: rgba(12, 17, 10, 0.8);
    color: #a0b290;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.bet-adjust:hover { border-color: var(--gold); color: var(--gold); }
.bet-updown { padding: 0 0.5rem; }

.quick-bets { display: flex; gap: 0.4rem; }

.quick-bet {
    flex: 1;
    padding: 0.45rem 0;
    background: rgba(12, 17, 10, 0.8);
    border: 1px solid rgba(74, 103, 65, 0.2);
    border-radius: var(--radius-sm);
    color: #7a8c6e;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.quick-bet:hover { border-color: var(--gold); color: var(--gold); }

/* Difficulty Dropdown */
.difficulty-dropdown { position: relative; }

.diff-selected {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1rem;
    background: rgba(12, 17, 10, 0.8);
    border: 1px solid rgba(74, 103, 65, 0.3);
    border-radius: var(--radius-sm);
    color: #d8e0cc;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.diff-selected:hover { border-color: rgba(74, 103, 65, 0.5); }
.diff-selected i { margin-left: auto; font-size: 0.7rem; color: #7a8c6e; }

.diff-options {
    position: absolute;
    top: 100%; left: 0; right: 0;
    margin-top: 4px;
    background: var(--bg-card);
    border: 1px solid rgba(74, 103, 65, 0.3);
    border-radius: var(--radius-sm);
    overflow: hidden;
    z-index: 100;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.diff-option {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1rem;
    background: transparent;
    border: none;
    color: #a0b290;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.diff-option:hover { background: var(--bg-card-hover); color: #d8e0cc; }

.diff-option.active {
    background: rgba(46, 230, 122, 0.08);
    color: var(--jungle-green);
}

.diff-option small { margin-left: auto; font-size: 0.7rem; color: #7a8c6e; }

/* Action Buttons */
.actions-section { padding: 0; background: transparent; border: none; }

.btn-primary {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-start {
    background: linear-gradient(135deg, #2ee67a, #1ab05c);
    color: #0a1a0d;
    box-shadow: 0 4px 20px rgba(46, 230, 122, 0.3);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-start:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(46, 230, 122, 0.4);
    filter: brightness(1.1);
}

.btn-start:active { transform: translateY(0); }
.btn-start.disabled { opacity: 0.5; pointer-events: none; }

.btn-cashout {
    background: linear-gradient(135deg, var(--gold), var(--amber));
    color: #1a1000;
    box-shadow: var(--glow-gold);
    animation: cashout-pulse 1.5s ease-in-out infinite;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-cashout:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(232, 178, 48, 0.5);
}

.btn-cashout em { font-style: normal; font-size: 1.1rem; }

/* Stats */
.stats-section .stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(74, 103, 65, 0.1);
}

.stats-section .stat-item:last-child { border-bottom: none; }
.stat-label { font-size: 0.8rem; color: #7a8c6e; }

.stat-value {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.9rem;
    color: #d8e0cc;
}

.stat-value.multiplier { color: var(--jungle-green); }
.stat-value.profit { color: var(--gold); }

/* History */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    max-height: 140px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.6rem;
    background: rgba(12, 17, 10, 0.6);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
}

.history-item.win { border-left: 3px solid var(--jungle-green); }
.history-item.loss { border-left: 3px solid var(--accent-red); }
.history-item .history-multiplier { font-family: var(--font-display); font-weight: 600; }
.history-item.win .history-multiplier { color: var(--jungle-green); }
.history-item.loss .history-multiplier { color: var(--accent-red); }

/* ========================================
   Tower Section (Center)
   ======================================== */
.tower-section {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 2rem 1rem;
    min-height: 0;
}

/* Gorilla Mascot - subtle background watermark behind tower board */
.gorilla-mascot {
    position: absolute;
    right: -200px;
    bottom: -40px;
    width: 380px;
    height: auto;
    z-index: 0;
    pointer-events: none;
    opacity: 0.18;
    filter: blur(1px) drop-shadow(0 0 40px rgba(232, 178, 48, 0.05));
    mix-blend-mode: screen;
}

.gorilla-img {
    width: 100%;
    height: auto;
}

/* Tower Board */
.tower-board {
    position: relative;
    background: 
        linear-gradient(145deg, rgba(26, 36, 22, 0.92), rgba(12, 17, 10, 0.95));
    border: 2px solid rgba(74, 103, 65, 0.15);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    padding-right: 5.5rem;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 80px rgba(46, 230, 122, 0.03),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
    width: 100%;
    max-width: 580px;
    backdrop-filter: blur(6px);
}

.tower-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

/* Tower Multipliers */
.tower-multipliers {
    position: absolute;
    right: 0.75rem;
    top: 1.25rem;
    bottom: 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

.tower-mult-label {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0.2rem 0.5rem;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 20px;
    font-size: 0.68rem;
    font-family: var(--font-display);
    font-weight: 600;
    color: #5a6e4e;
    white-space: nowrap;
    border: 1px solid transparent;
    transition: var(--transition-normal);
}

.tower-mult-label .dot {
    width: 5px; height: 5px;
    border-radius: 50%;
    background: var(--jungle-green);
    opacity: 0.5;
}

.tower-mult-label.active {
    color: var(--jungle-green);
    background: rgba(46, 230, 122, 0.08);
    border-color: rgba(46, 230, 122, 0.2);
}

.tower-mult-label.active .dot { opacity: 1; }

.tower-mult-label.completed {
    color: var(--jungle-green);
    opacity: 0.5;
}

/* Tower Floor */
.tower-floor {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    opacity: 0.45;
    transition: var(--transition-normal);
}

.tower-floor.active { opacity: 1; animation: floor-activate 0.4s ease; }
.tower-floor.completed { opacity: 0.65; }
.tower-floor.exploded { animation: floor-explode 0.6s ease; }

/* Tower Tile - Dark stone/wood style */
.tower-tile {
    aspect-ratio: 2.2/1;
    background: 
        linear-gradient(180deg, #2a3525 0%, #1e2a1a 50%, #192116 100%);
    border: 1px solid rgba(74, 103, 65, 0.12);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
    position: relative;
    overflow: hidden;
    transition: var(--transition-normal);
    box-shadow: 
        0 2px 6px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
    min-height: 42px;
}

/* Subtle fruit silhouette */
.tower-tile::before {
    content: '🍎';
    position: absolute;
    font-size: 1.1rem;
    opacity: 0.1;
    pointer-events: none;
    transition: var(--transition-normal);
}

/* Active floor tiles glow with jungle green */
.tower-floor.active .tower-tile {
    cursor: pointer;
    border-color: rgba(46, 230, 122, 0.25);
    background: 
        linear-gradient(180deg, #2a3e22 0%, #1e3218 50%, #1a2a14 100%);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.4),
        0 0 12px rgba(46, 230, 122, 0.06),
        inset 0 1px 0 rgba(46, 230, 122, 0.05);
}

.tower-floor.active .tower-tile::before { opacity: 0.2; }

.tower-floor.active .tower-tile:hover {
    border-color: var(--jungle-green);
    background: 
        linear-gradient(180deg, #335228 0%, #264520 50%, #1e3818 100%);
    box-shadow: 
        0 4px 15px rgba(46, 230, 122, 0.15),
        0 0 20px rgba(46, 230, 122, 0.08),
        inset 0 0 15px rgba(46, 230, 122, 0.03);
    transform: scale(1.04);
}

.tower-tile .tile-content {
    font-size: 1.5rem;
    opacity: 0;
    transition: var(--transition-normal);
    transform: scale(0);
    z-index: 2;
}

.tower-tile.revealed .tile-content { opacity: 1; transform: scale(1); }

.tower-tile.revealed.safe {
    background: linear-gradient(180deg, rgba(46, 230, 122, 0.15), rgba(26, 176, 92, 0.2));
    border-color: rgba(46, 230, 122, 0.5);
    box-shadow: var(--glow-green);
}

.tower-tile.revealed.bomb {
    background: linear-gradient(180deg, rgba(224, 82, 82, 0.15), rgba(107, 34, 34, 0.25));
    border-color: rgba(224, 82, 82, 0.5);
    box-shadow: var(--glow-red);
}

.tower-tile.revealed.selected-safe {
    background: linear-gradient(180deg, rgba(46, 230, 122, 0.25), rgba(26, 176, 92, 0.35));
    border-color: var(--jungle-moss);
    box-shadow: 0 0 25px rgba(46, 230, 122, 0.35);
}

.tower-tile.revealed.selected-bomb {
    background: linear-gradient(180deg, rgba(224, 82, 82, 0.3), rgba(107, 34, 34, 0.45));
    border-color: var(--accent-red-light);
    box-shadow: 0 0 30px rgba(224, 82, 82, 0.4);
    animation: bomb-selected 0.8s ease;
}

/* ========================================
   Result Overlay
   ======================================== */
.result-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(8, 12, 6, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-normal);
}

.result-overlay.show { opacity: 1; pointer-events: all; }

.result-content {
    background: linear-gradient(145deg, #1e2a1a, #141c12);
    border: 2px solid rgba(74, 103, 65, 0.2);
    border-radius: var(--radius-xl);
    padding: 3rem;
    text-align: center;
    max-width: 420px;
    width: 90%;
    animation: result-appear 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.result-content.win {
    border-color: var(--jungle-green);
    box-shadow: 0 0 60px rgba(46, 230, 122, 0.12);
}

.result-content.loss {
    border-color: var(--accent-red);
    box-shadow: 0 0 60px rgba(224, 82, 82, 0.12);
}

.result-icon { font-size: 4rem; margin-bottom: 1.5rem; }
.result-content.win .result-icon { color: var(--jungle-green); animation: trophy-bounce 0.6s ease; }
.result-content.loss .result-icon { color: var(--accent-red); animation: skull-shake 0.6s ease; }

.result-title {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.result-content.win .result-title { color: var(--jungle-green); }
.result-content.loss .result-title { color: var(--accent-red-light); }

.result-details { font-size: 0.9rem; color: #7a8c6e; margin-bottom: 1.5rem; }

.result-amount {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    margin: 1rem 0;
}

.result-content.win .result-amount { color: var(--gold-light); text-shadow: 0 0 20px var(--amber-glow); }
.result-content.loss .result-amount { color: var(--accent-red-light); }

.result-btn {
    padding: 0.8rem 2.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition-normal);
}

.result-content.win .result-btn { background: var(--jungle-green); color: #0a1a0d; }
.result-content.loss .result-btn { background: var(--accent-red); color: #fff; }
.result-btn:hover { transform: scale(1.05); filter: brightness(1.1); }

/* ========================================
   Utilities
   ======================================== */
.hidden { display: none !important; }

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--jungle-olive); border-radius: 4px; }

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 900px) {
    .game-body { grid-template-columns: 1fr; }
    .tower-section { order: -1; }
    .gorilla-mascot { display: none; }
    .leaves-left, .leaves-right { display: none; }
}

@media (max-width: 600px) {
    html { font-size: 12px; }
    .game-header { flex-wrap: wrap; gap: 0.5rem; }
    .tower-board { padding: 1rem; padding-right: 3.5rem; }
}
