/* ============================================
   COIN PUSHER 3D - Stylesheet
   Casino-themed with warm gold/wood tones
   ============================================ */

:root {
    --gold: #ffd700;
    --gold-dark: #b8860b;
    --gold-light: #fff3a0;
    --casino-red: #8b0000;
    --casino-green: #0d4f0d;
    --wood-dark: #3e2723;
    --wood-light: #6d4c41;
    --bg-dark: #1a1a2e;
    --bg-panel: rgba(20, 20, 40, 0.95);
    --text-light: #f0e6d3;
    --text-gold: #ffd700;
    --glow-gold: 0 0 15px rgba(255, 215, 0, 0.5);
    --glow-red: 0 0 15px rgba(255, 0, 0, 0.5);
}

/* FIXED: Mobile touch optimization */
html {
    touch-action: manipulation;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cinzel', serif;
    background: var(--bg-dark);
    color: var(--text-light);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* FIXED: Canvas touch-action */
#game-canvas {
    touch-action: none;
    -webkit-touch-callout: none;
}

/* ---- Game Container ---- */
#game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* ---- HUD ---- */
#hud {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

#hud > * {
    pointer-events: auto;
}

/* ---- Top Bar ---- */
#top-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 10px 15px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.8) 0%, transparent 100%);
    gap: 10px;
}

#currency-display {
    display: flex;
    gap: 15px;
}

.currency-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 1.2em;
    font-weight: bold;
    background: rgba(0,0,0,0.6);
    padding: 5px 12px;
    border-radius: 20px;
    border: 2px solid var(--gold-dark);
}

.coin-icon { font-size: 1.3em; }
.gem-icon { font-size: 1.3em; }

#level-display {
    flex: 1;
    max-width: 300px;
    text-align: center;
}

#level-badge {
    background: linear-gradient(135deg, var(--gold-dark), var(--gold));
    color: #000;
    padding: 3px 15px;
    border-radius: 15px;
    font-weight: 900;
    font-size: 0.9em;
    display: inline-block;
    margin-bottom: 3px;
}

#xp-bar-container {
    position: relative;
    width: 100%;
    height: 16px;
    background: rgba(0,0,0,0.6);
    border-radius: 8px;
    border: 1px solid var(--gold-dark);
    overflow: hidden;
}

#xp-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--gold-dark), var(--gold));
    border-radius: 8px;
    transition: width 0.3s ease;
    width: 0%;
}

#xp-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.7em;
    font-weight: bold;
    color: #000;
}

#menu-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.menu-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--gold-dark);
    background: rgba(0,0,0,0.6);
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.2s;
}

.menu-btn:hover {
    background: var(--gold-dark);
    transform: scale(1.1);
    box-shadow: var(--glow-gold);
}

.menu-btn:active {
    transform: scale(0.95);
}

/* ---- Combo Meter ---- */
#combo-meter {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2em;
    font-weight: 900;
    color: var(--gold);
    text-shadow: var(--glow-gold);
    animation: combo-pulse 0.3s ease;
}

#combo-meter.hidden { display: none; }

/* ---- Shake Meter ---- */
#shake-meter-container {
    position: absolute;
    bottom: 60px;
    left: 20px;
    width: 150px;
}

#shake-meter-container.hidden { display: none; }

#shake-meter-bar {
    width: 100%;
    height: 12px;
    background: rgba(0,0,0,0.6);
    border-radius: 6px;
    border: 1px solid #ff9800;
    overflow: hidden;
    margin-top: 3px;
}

#shake-meter-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ff9800, #ff5722);
    border-radius: 6px;
    transition: width 0.1s;
}

/* ---- Jackpot Meter ---- */
#jackpot-meter-container {
    position: absolute;
    bottom: 60px;
    right: 20px;
    width: 150px;
}

#jackpot-meter-container.hidden { display: none; }

#jackpot-meter-bar {
    width: 100%;
    height: 12px;
    background: rgba(0,0,0,0.6);
    border-radius: 6px;
    border: 1px solid #ffd700;
    overflow: hidden;
    margin-top: 3px;
}

#jackpot-meter-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ffd700, #ff8c00);
    border-radius: 6px;
    transition: width 0.1s;
}

.meter-label {
    font-size: 0.7em;
    font-weight: bold;
    color: #aaa;
}

@keyframes combo-pulse {
    0% { transform: translate(-50%, -50%) scale(1.5); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

/* ---- Notifications ---- */
#notifications {
    position: absolute;
    bottom: 100px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.notification {
    background: var(--bg-panel);
    border: 2px solid var(--gold);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9em;
    animation: notif-in 0.3s ease, notif-out 0.3s ease 2.7s;
    box-shadow: var(--glow-gold);
}

.notification.success { border-color: #4caf50; }
.notification.warning { border-color: #ff9800; }
.notification.error { border-color: #f44336; box-shadow: var(--glow-red); }
.notification.gem { border-color: #e040fb; }

@keyframes notif-in {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes notif-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ---- Drop Zone ---- */
#drop-zone {
    position: absolute;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 40px;
    border: 2px dashed rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

#drop-zone.active {
    opacity: 1;
    border-color: rgba(255, 215, 0, 0.7);
}

/* ---- Machine Coins ---- */
#machine-coins {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.6);
    padding: 5px 15px;
    border-radius: 15px;
    font-size: 0.85em;
    border: 1px solid var(--gold-dark);
}

/* ---- Modal Overlay ---- */
#modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}

#modal-overlay.hidden { display: none; }

.modal {
    background: var(--bg-panel);
    border: 3px solid var(--gold-dark);
    border-radius: 15px;
    padding: 20px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.2);
}

.modal.hidden { display: none; }

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

.modal-header h2 {
    color: var(--gold);
    font-size: 1.3em;
}

.modal-close {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: 2px solid var(--gold-dark);
    background: transparent;
    color: var(--gold);
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--casino-red);
    border-color: var(--casino-red);
}

/* ---- Upgrade Shop ---- */
#upgrade-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.upgrade-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--gold-dark);
    border-radius: 10px;
    padding: 12px;
}

.upgrade-info h3 {
    color: var(--gold);
    font-size: 1em;
    margin-bottom: 3px;
}

.upgrade-info p {
    font-size: 0.8em;
    color: #aaa;
}

.upgrade-level {
    display: flex;
    gap: 3px;
    margin-top: 5px;
}

.upgrade-pip {
    width: 12px;
    height: 6px;
    border-radius: 3px;
    background: rgba(255,255,255,0.2);
}

.upgrade-pip.filled {
    background: var(--gold);
}

.upgrade-buy-btn {
    background: linear-gradient(135deg, var(--gold-dark), var(--gold));
    color: #000;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-family: 'Cinzel', serif;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.upgrade-buy-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: var(--glow-gold);
}

.upgrade-buy-btn:disabled {
    background: #555;
    color: #888;
    cursor: not-allowed;
}

/* ---- Daily Spin ---- */
#daily-spin-container {
    text-align: center;
    margin-bottom: 20px;
}

#spin-wheel {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 4px solid var(--gold);
    margin: 0 auto 15px;
    position: relative;
    overflow: hidden;
    transition: transform 3s cubic-bezier(0.17, 0.67, 0.12, 0.99);
}

#spin-btn {
    background: linear-gradient(135deg, var(--gold-dark), var(--gold));
    color: #000;
    border: none;
    padding: 10px 25px;
    border-radius: 25px;
    font-family: 'Cinzel', serif;
    font-weight: bold;
    font-size: 1em;
    cursor: pointer;
}

#spin-btn:disabled {
    background: #555;
    color: #888;
    cursor: not-allowed;
}

/* ---- Login Streak ---- */
#login-streak {
    text-align: center;
}

#streak-rewards {
    display: flex;
    gap: 5px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 10px;
}

.streak-day {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: 2px solid var(--gold-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.55em;
    background: rgba(0,0,0,0.4);
    cursor: default;
}

.streak-day.claimed {
    background: var(--gold-dark);
    color: #000;
}

.streak-day.today {
    border-color: var(--gold);
    box-shadow: var(--glow-gold);
    animation: streak-pulse 1.5s ease infinite;
}

.streak-day.future {
    opacity: 0.35;
    border-color: #555;
}

.streak-day-num {
    font-weight: bold;
    font-size: 1.2em;
}

.streak-day-reward {
    font-size: 1.0em;
    margin-top: -2px;
}

@keyframes streak-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ---- Achievements ---- */
#achievements-panel .modal-header h2 span {
    font-size: 0.6em;
    color: #aaa;
    margin-left: 10px;
}

#achievements-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 5px;
}

.achievement-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.3);
}

.achievement-item.locked {
    opacity: 0.5;
}

.achievement-item.unlocked {
    border-color: var(--gold);
    background: rgba(255,215,0,0.1);
}

.achievement-item.claimed {
    border-color: #4caf50;
    background: rgba(76,175,80,0.1);
    opacity: 0.7;
}

.achievement-icon {
    font-size: 2em;
    width: 50px;
    text-align: center;
    flex-shrink: 0;
}

.achievement-info {
    flex: 1;
    min-width: 0;
}

.achievement-name {
    font-weight: bold;
    color: var(--gold);
    font-size: 0.95em;
}

.achievement-desc {
    font-size: 0.8em;
    color: #aaa;
    margin-top: 2px;
}

.achievement-progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    margin-top: 5px;
    overflow: hidden;
}

.achievement-progress-fill {
    height: 100%;
    background: var(--gold);
    border-radius: 2px;
    transition: width 0.3s;
}

.achievement-reward {
    text-align: right;
    flex-shrink: 0;
}

.achievement-reward-text {
    font-size: 0.8em;
    color: var(--gold);
    margin-bottom: 5px;
}

.achievement-claim-btn {
    background: var(--gold);
    color: #000;
    border: none;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
    cursor: pointer;
}

.achievement-claim-btn:hover {
    background: #fff;
}

.achievement-claimed-text {
    font-size: 0.8em;
    color: #4caf50;
}

/* ---- Quests ---- */
#quest-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.quest-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,215,0,0.3);
    border-radius: 8px;
    padding: 10px;
}

.quest-item.completed {
    border-color: #4caf50;
    opacity: 0.7;
}

.quest-progress-bar {
    width: 100px;
    height: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    overflow: hidden;
}

.quest-progress-fill {
    height: 100%;
    background: var(--gold);
    border-radius: 4px;
    transition: width 0.3s;
}

/* ---- Themes ---- */
#theme-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.theme-card {
    background: rgba(0,0,0,0.4);
    border: 2px solid var(--gold-dark);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.theme-card:hover:not(.locked) {
    border-color: var(--gold);
    transform: translateY(-2px);
}

.theme-card.active {
    border-color: var(--gold);
    box-shadow: var(--glow-gold);
}

.theme-card.locked {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: #555;
}

.theme-card h3 {
    font-size: 0.9em;
    margin-bottom: 5px;
}

.theme-card .theme-req {
    font-size: 0.7em;
    color: #aaa;
}

/* ---- Prestige ---- */
#prestige-info {
    text-align: center;
}

#prestige-info p {
    margin: 10px 0;
    font-size: 1.1em;
}

#prestige-btn {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: #000;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-family: 'Cinzel', serif;
    font-weight: 900;
    font-size: 1.1em;
    cursor: pointer;
    margin-top: 15px;
    transition: all 0.2s;
}

#prestige-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.7);
}

#prestige-btn:disabled {
    background: #555;
    color: #888;
    cursor: not-allowed;
}

/* ---- Level Up ---- */
.levelup-content {
    text-align: center;
}

.levelup-content h1 {
    font-size: 2.5em;
    color: var(--gold);
    text-shadow: var(--glow-gold);
    animation: levelup-glow 0.5s ease infinite alternate;
}

@keyframes levelup-glow {
    from { text-shadow: 0 0 15px rgba(255, 215, 0, 0.5); }
    to { text-shadow: 0 0 30px rgba(255, 215, 0, 0.9); }
}

#levelup-num {
    font-size: 1.5em;
    margin: 10px 0;
}

#levelup-reward {
    color: var(--gold);
    margin-bottom: 20px;
}

#levelup-continue {
    background: linear-gradient(135deg, var(--gold-dark), var(--gold));
    color: #000;
    border: none;
    padding: 10px 30px;
    border-radius: 25px;
    font-family: 'Cinzel', serif;
    font-weight: bold;
    font-size: 1.1em;
    cursor: pointer;
}

/* ---- Slot Machine ---- */
#slot-machine {
    text-align: center;
}

#slot-reels {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
}

.slot-reel {
    width: 70px;
    height: 70px;
    border: 3px solid var(--gold);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    background: rgba(0,0,0,0.6);
}

.slot-reel.spinning {
    animation: slot-spin 0.1s linear infinite;
}

@keyframes slot-spin {
    0% { transform: translateY(-5px); }
    50% { transform: translateY(5px); }
    100% { transform: translateY(-5px); }
}

#slot-spin-btn {
    background: linear-gradient(135deg, var(--gold-dark), var(--gold));
    color: #000;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-family: 'Cinzel', serif;
    font-weight: bold;
    cursor: pointer;
}

#slot-spin-btn:disabled {
    background: #555;
    color: #888;
    cursor: not-allowed;
}

#slot-result {
    margin-top: 10px;
    font-size: 1.1em;
    color: var(--gold);
}

/* ---- Stats Panel ---- */
.stats-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    border: 1px solid rgba(255,215,0,0.2);
}

.stat-row span:first-child {
    color: var(--gold);
}

.stat-row span:last-child {
    font-weight: bold;
}

/* ---- Settings ---- */
.settings-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.settings-content label {
    display: flex;
    align-items: center;
    gap: 10px;
}

.settings-content input[type="range"] {
    flex: 1;
}

#btn-reset {
    background: var(--casino-red);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 8px;
    font-family: 'Cinzel', serif;
    cursor: pointer;
    margin-top: 10px;
}

/* ---- Puzzle ---- */
#puzzle-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.puzzle-card {
    background: rgba(0,0,0,0.4);
    border: 2px solid var(--gold-dark);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
}

.puzzle-card h3 {
    font-size: 0.9em;
    color: var(--gold);
    margin-bottom: 8px;
}

.puzzle-pieces {
    display: flex;
    gap: 3px;
    justify-content: center;
    flex-wrap: wrap;
}

.puzzle-piece {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,215,0,0.3);
}

.puzzle-piece.collected {
    background: var(--gold);
    border-color: var(--gold);
}

/* ---- Loading Screen ---- */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

#loading-screen.hidden {
    display: none;
}

.loading-content {
    text-align: center;
}

.loading-content h1 {
    font-size: 2.5em;
    color: var(--gold);
    text-shadow: var(--glow-gold);
    margin-bottom: 30px;
}

.loading-bar {
    width: 300px;
    height: 10px;
    background: rgba(255,255,255,0.1);
    border-radius: 5px;
    overflow: hidden;
    margin: 0 auto 15px;
}

#loading-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--gold-dark), var(--gold));
    border-radius: 5px;
    width: 0%;
    transition: width 0.3s;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
    #top-bar {
        flex-wrap: wrap;
        padding: 5px 10px;
    }
    
    #currency-display {
        gap: 8px;
    }
    
    .currency-item {
        font-size: 1em;
        padding: 3px 8px;
    }
    
    .menu-btn {
        width: 35px;
        height: 35px;
        font-size: 1em;
    }
    
    #level-display {
        order: 3;
        max-width: 100%;
        width: 100%;
        margin-top: 5px;
    }
    
    .modal {
        width: 95%;
        padding: 15px;
    }
}
