/**
 * GLiBz Frontier - Core Styles
 * Western-themed UI for popups, nugget awards, preferences,
 * ambient effects, mini-games, events, and toasts.
 */

/* ── Popup (bottom-center slide-up) ────────────────────────────── */

#glibz-frontier-popup {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: none;
}

.gf-popup {
    position: relative;
    background: #1a1a0e;
    border: 2px solid #D4A843;
    border-radius: 8px;
    padding: 20px 30px;
    color: #e8dcc8;
    font-family: 'Courier New', Courier, monospace;
    max-width: 400px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6), 0 0 12px rgba(212, 168, 67, 0.2);
}

.gf-popup-enter {
    animation: gf-popup-slide 0.4s ease-out;
}

.gf-popup-close {
    position: absolute;
    top: 6px;
    right: 10px;
    background: none;
    border: none;
    color: #D4A843;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
}

.gf-popup-close:hover {
    color: #fff;
}

/* ── Nugget Award (floating notification) ──────────────────────── */

.gf-nugget-award {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10002;
    color: #D4A843;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.4rem;
    font-weight: bold;
    text-align: center;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
    pointer-events: none;
    transition: transform 2.5s ease-out, opacity 2.5s ease-out;
}

.gf-nugget-award-fly {
    transform: translateX(-50%) translateY(-100px);
    opacity: 0;
}

.gf-nugget-award small {
    font-size: 0.7em;
    color: #c4a060;
}

.gf-nugget-icon {
    color: #D4A843;
    font-size: 1.2em;
}

/* ── Preferences Gear Button ───────────────────────────────────── */

.gf-prefs-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #1a1a0e;
    border: 2px solid #D4A843;
    color: #D4A843;
    font-size: 1.3rem;
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: background 0.2s;
}

.gf-prefs-btn:hover {
    background: #2a2a1e;
}

/* ── Preferences Menu ──────────────────────────────────────────── */

.gf-prefs-menu {
    position: fixed;
    bottom: 70px;
    right: 20px;
    background: #1a1a0e;
    border: 2px solid #D4A843;
    border-radius: 8px;
    padding: 14px 18px;
    color: #e8dcc8;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    z-index: 9999;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.gf-prefs-title {
    color: #D4A843;
    font-weight: bold;
    margin-bottom: 10px;
    font-family: Georgia, serif;
}

.gf-prefs-menu label {
    display: block;
    padding: 4px 0;
    cursor: pointer;
}

.gf-prefs-menu input[type="radio"],
.gf-prefs-menu input[type="checkbox"] {
    accent-color: #D4A843;
    margin-right: 6px;
}

.gf-prefs-sound {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #333;
}

/* ── Daily Login Popup Content ─────────────────────────────────── */

.gf-daily-login {
    text-align: center;
}

.gf-daily-login h3 {
    font-family: Rye, Georgia, 'Times New Roman', serif;
    color: #D4A843;
    margin: 0 0 8px;
    font-size: 1.3rem;
}

.gf-daily-login p {
    margin: 4px 0;
}

.gf-nugget-burst {
    font-size: 1.8rem;
    color: #D4A843;
    font-weight: bold;
    animation: gf-nugget-float 2s ease-out forwards;
    margin-top: 8px;
}

/* ── Frontier Effects Layer ────────────────────────────────────── */

#glibz-frontier-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

/* ── Tumbleweed ────────────────────────────────────────────────── */

.gf-tumbleweed {
    position: absolute;
    bottom: 40px;
    left: -80px;
    pointer-events: auto;
    cursor: pointer;
    animation: gf-tumbleweed-roll 10s linear forwards;
    opacity: 0.8;
    z-index: 1;
}

.gf-tumbleweed:hover {
    opacity: 1;
}

.gf-tumbleweed-golden {
    filter: drop-shadow(0 0 12px #D4A843) drop-shadow(0 0 4px #FFD700);
    animation-name: gf-tumbleweed-roll;
}

.gf-tumbleweed-golden svg g {
    stroke: #D4A843;
}

/* ── Shooting Star ─────────────────────────────────────────────── */

.gf-star {
    position: absolute;
    width: 80px;
    height: 2px;
    background: linear-gradient(90deg, rgba(255,255,255,0.9), transparent);
    transform: rotate(-35deg);
    animation: gf-star-streak 1s ease-out forwards;
    pointer-events: none;
}

/* ── Lightning ─────────────────────────────────────────────────── */

.gf-lightning {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.15);
    animation: gf-lightning-flash 0.3s ease-out forwards;
    pointer-events: none;
}

/* ── Dust Canvas ───────────────────────────────────────────────── */

.gf-dust-canvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.3;
    z-index: -1;
}

/* ── Game Modal & Overlay ──────────────────────────────────────── */

.gf-game-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gf-game-modal {
    position: relative;
    background: #1a1a0e;
    border: 2px solid #D4A843;
    border-radius: 12px;
    padding: 24px 30px;
    color: #e8dcc8;
    font-family: 'Courier New', Courier, monospace;
    max-width: 90vw;
    width: 420px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.7), 0 0 20px rgba(212, 168, 67, 0.15);
}

.gf-modal-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    color: #D4A843;
    font-size: 1.2rem;
    cursor: pointer;
}

.gf-game-choice {
    display: block;
    width: 100%;
    padding: 12px 16px;
    background: #2a2a1e;
    border: 1px solid #D4A843;
    border-radius: 6px;
    color: #D4A843;
    font-family: Georgia, serif;
    font-size: 1.1rem;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s;
}

.gf-game-choice:hover {
    background: #3a3a2e;
}

.gf-game-choice:disabled {
    opacity: 0.5;
    cursor: default;
}

/* ── Slot Machine Reels ────────────────────────────────────────── */

.gf-spin-reel {
    display: inline-block;
    width: 70px;
    height: 60px;
    overflow: hidden;
    border: 2px solid #D4A843;
    border-radius: 6px;
    background: #0D1117;
}

.gf-spin-strip {
    transition: transform 1s cubic-bezier(0.17, 0.67, 0.12, 0.99);
}

.gf-spin-icon {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
}

/* ── Quick Draw ────────────────────────────────────────────────── */

.gf-quickdraw-target {
    text-align: center;
    padding: 40px 20px;
    cursor: crosshair;
    user-select: none;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* ── Gold Rush Timer ───────────────────────────────────────────── */

.gf-gold-rush-timer {
    position: fixed;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #D4A843, #B87333);
    color: #1a1a0e;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    padding: 8px 16px;
    border-radius: 6px;
    z-index: 10002;
    box-shadow: 0 2px 12px rgba(212, 168, 67, 0.5);
}

/* ── Wanted Poster ─────────────────────────────────────────────── */

.gf-wanted-poster {
    background: #F5E6C8;
    border: 4px solid #8B4513;
    border-radius: 4px;
    padding: 20px;
    text-align: center;
    color: #3a2a1a;
    font-family: 'Courier New', monospace;
}

.gf-wanted-header {
    font-family: Rye, Georgia, serif;
    font-size: 2rem;
    color: #8B0000;
    letter-spacing: 4px;
    animation: gf-wanted-stamp 0.5s ease-out;
}

.gf-wanted-subheader {
    font-size: 0.8rem;
    letter-spacing: 2px;
    margin: 4px 0 12px;
    color: #555;
}

.gf-wanted-name {
    font-size: 1.4rem;
    font-weight: bold;
    color: #3a2a1a;
    margin: 8px 0;
    border-top: 2px solid #8B4513;
    border-bottom: 2px solid #8B4513;
    padding: 8px 0;
}

.gf-wanted-reward {
    font-size: 0.9rem;
    color: #666;
    margin-top: 8px;
}

.gf-wanted-actions {
    margin-top: 12px;
}

.gf-wanted-actions button {
    background: #8B4513;
    color: #F5E6C8;
    border: none;
    padding: 6px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
}

.gf-wanted-actions button:hover {
    background: #A0522D;
}

/* ── Event Mule ────────────────────────────────────────────────── */

.gf-event-mule {
    position: fixed;
    cursor: pointer;
    z-index: 10001;
    animation: gf-bounce 0.5s ease-in-out infinite;
    text-align: center;
}

.gf-event-label {
    color: #D4A843;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    margin-top: 4px;
}

/* ── Toast (bottom-left wisdom) ────────────────────────────────── */

.gf-toast {
    position: fixed;
    bottom: 20px;
    left: -350px;
    width: 300px;
    background: #1a1a0e;
    border: 1px solid #D4A843;
    border-radius: 6px;
    padding: 14px 18px;
    color: #c4a060;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    z-index: 9998;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
    transition: left 0.5s ease-out;
}

.gf-toast-visible {
    left: 20px;
}

.gf-toast strong {
    color: #D4A843;
}

/* ── Games Button ──────────────────────────────────────────────── */

.gf-games-btn {
    position: fixed;
    bottom: 70px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #1a1a0e;
    border: 2px solid #D4A843;
    color: #D4A843;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: background 0.2s;
}

.gf-games-btn:hover {
    background: #2a2a1e;
}

/* ── Effects-level visibility overrides ─────────────────────────── */

body[data-gf-effects="off"] .gf-tumbleweed,
body[data-gf-effects="off"] .gf-dust-canvas,
body[data-gf-effects="off"] .gf-star,
body[data-gf-effects="off"] .gf-lightning {
    display: none !important;
}

body[data-gf-effects="reduced"] .gf-dust-canvas,
body[data-gf-effects="reduced"] .gf-star,
body[data-gf-effects="reduced"] .gf-lightning {
    display: none !important;
}

/* ── Mobile adjustments ────────────────────────────────────────── */

@media (max-width: 768px) {
    .gf-popup {
        max-width: calc(100vw - 40px);
        padding: 14px 18px;
        font-size: 0.85rem;
    }

    .gf-game-modal {
        width: calc(100vw - 30px);
        padding: 16px 18px;
    }

    .gf-prefs-menu {
        right: 10px;
        bottom: 65px;
    }

    .gf-prefs-btn,
    .gf-games-btn {
        width: 36px;
        height: 36px;
        right: 10px;
    }

    .gf-games-btn {
        bottom: 60px;
    }

    .gf-toast {
        width: 240px;
    }

    .gf-gold-rush-timer {
        font-size: 0.85rem;
        padding: 6px 10px;
    }
}

/* ── Respect prefers-reduced-motion ────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .gf-popup-enter,
    .gf-tumbleweed,
    .gf-star,
    .gf-lightning,
    .gf-nugget-burst,
    .gf-nugget-award,
    .gf-event-mule,
    .gf-wanted-header,
    .gf-tumbleweed-golden {
        animation: none !important;
    }

    .gf-nugget-award {
        transition: none !important;
    }

    .gf-toast {
        transition: none !important;
        left: 20px;
    }
}
