/* ============================================
   RUSH HOUR - Complete Stylesheet
   Multi-Wallet Support | Mobile Ready
   ============================================ */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0a0a1a, #1a1a3e);
    color: #fff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* ============================================
   HEADER
   ============================================ */
header {
    width: 100%;
    max-width: 600px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 15px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex-wrap: wrap;
    gap: 10px;
    z-index: 10;
}

.logo {
    font-size: 22px;
    font-weight: bold;
    background: linear-gradient(90deg, #9945FF, #14F195);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Badges */
.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge.guest {
    background: rgba(255, 255, 255, 0.1);
    color: #aaa;
}

.badge.connected {
    background: rgba(20, 241, 149, 0.2);
    color: #14F195;
    border: 1px solid rgba(20, 241, 149, 0.3);
}

/* Token Balance */
#tokenBalance {
    font-size: 13px;
    background: rgba(20, 241, 149, 0.15);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid rgba(20, 241, 149, 0.3);
    color: #14F195;
    white-space: nowrap;
}

#tokenBalance.hidden {
    display: none !important;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-connect {
    padding: 8px 18px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
    background: linear-gradient(135deg, #9945FF, #14F195);
    color: #fff;
    white-space: nowrap;
}

.btn-connect:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(153, 69, 255, 0.3);
}

.btn-connect.connected {
    background: rgba(20, 241, 149, 0.15);
    border: 1px solid #14F195;
    color: #14F195;
}

.btn-connect.connected:hover {
    background: rgba(20, 241, 149, 0.25);
    box-shadow: 0 0 20px rgba(20, 241, 149, 0.2);
    transform: scale(1.05);
}

.btn-primary {
    background: linear-gradient(135deg, #9945FF, #14F195);
    color: #fff;
    padding: 14px 40px;
    font-size: 18px;
    border: none;
    border-radius: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(153, 69, 255, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 12px 30px;
    font-size: 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.02);
}

.btn-high-stakes {
    background: linear-gradient(135deg, #ff6b35, #ff2d55);
    color: #fff;
    padding: 12px 30px;
    font-size: 16px;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-high-stakes:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(255, 45, 85, 0.4);
}

.btn-high-stakes.hidden {
    display: none !important;
}

.btn-claim {
    background: linear-gradient(135deg, #ffd93d, #ff6b35);
    color: #1a1a2e;
    padding: 14px 35px;
    font-size: 17px;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: pulse 2s infinite;
}

.btn-claim:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(255, 217, 61, 0.4);
}

.btn-text {
    background: transparent;
    color: #888;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 8px 16px;
    transition: color 0.3s ease;
}

.btn-text:hover {
    color: #fff;
}

/* ============================================
   WALLET MODAL
   ============================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    padding: 20px;
}

.modal:not(.hidden) {
    display: flex !important;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a3e, #2a1a4e);
    border-radius: 24px;
    padding: 30px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8);
    animation: modalSlideUp 0.4s ease;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.modal-header h2 {
    font-size: 24px;
    background: linear-gradient(90deg, #9945FF, #14F195);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-close {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: #888;
    font-size: 28px;
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 8px;
    transition: all 0.3s ease;
    line-height: 1;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: rotate(90deg);
}

.modal-subtitle {
    color: #aaa;
    font-size: 14px;
    margin-bottom: 24px;
}

/* Wallet Sections */
.wallet-section {
    margin-bottom: 20px;
}

.section-label {
    font-size: 13px;
    color: #888;
    margin-bottom: 10px;
    text-align: left;
    padding-left: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 8px;
}

/* Wallet Grid */
.wallet-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 8px;
}

.wallet-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-height: 100px;
}

.wallet-option:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(153, 69, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(153, 69, 255, 0.15);
}

.wallet-option:active {
    transform: scale(0.96);
}

.wallet-option .wallet-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.wallet-option .wallet-name {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

.wallet-option .wallet-status {
    font-size: 10px;
    padding: 2px 10px;
    border-radius: 10px;
    margin-top: 4px;
    font-weight: 600;
}

/* Wallet Icon Colors */
.wallet-icon.phantom { color: #5344BD; }
.wallet-icon.solflare { color: #FF6B00; }
.wallet-icon.backpack { color: #FF6B6B; }
.wallet-icon.glow { color: #FFD93D; }
.wallet-icon.nightly { color: #6BCB77; }
.wallet-icon.coinbase { color: #0052FF; }
.wallet-icon.trust { color: #1976D2; }
.wallet-icon.exodus { color: #F5A623; }

/* WalletConnect specific */
.walletconnect-option {
    min-height: 80px;
}

.modal-footer {
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.wallet-help {
    font-size: 13px;
    color: #888;
    margin-bottom: 12px;
    line-height: 1.6;
}

.wallet-help a {
    color: #9945FF;
    text-decoration: none;
    transition: color 0.3s ease;
}

.wallet-help a:hover {
    color: #14F195;
    text-decoration: underline;
}

#cancelWalletBtn {
    color: #666;
}

#cancelWalletBtn:hover {
    color: #fff;
}

/* ============================================
   WALLETCONNECT MODAL
   ============================================ */
.wc-content {
    max-width: 400px;
}

.wc-body {
    text-align: center;
    padding: 10px 0;
}

.qr-container {
    width: 200px;
    height: 200px;
    margin: 0 auto 20px;
    background: #fff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.qr-container canvas,
.qr-container img {
    width: 100% !important;
    height: 100% !important;
}

.qr-placeholder {
    color: #888;
    font-size: 14px;
}

.wc-instructions {
    color: #aaa;
    font-size: 14px;
    line-height: 1.8;
    margin: 15px 0;
    text-align: left;
    background: rgba(255, 255, 255, 0.05);
    padding: 15px 20px;
    border-radius: 10px;
}

.wc-status {
    color: #ffd93d;
    font-size: 14px;
    margin: 15px 0;
    min-height: 24px;
}

#wcDeepLink {
    margin-top: 10px;
    width: 100%;
    display: none;
}

/* ============================================
   GAME AREA
   ============================================ */
main {
    position: relative;
    width: 400px;
    height: 600px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    background: #1a1a2e;
    touch-action: none;
}

/* ============================================
   GAME UI OVERLAY
   ============================================ */
#gameUI {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Score & Energy Display */
#scoreDisplay,
#energyDisplay {
    position: absolute;
    top: 15px;
    padding: 6px 14px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    pointer-events: none;
    z-index: 10;
}

#scoreDisplay {
    left: 15px;
}

#energyDisplay {
    right: 15px;
}

/* ============================================
   START SCREEN
   ============================================ */
#startScreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    pointer-events: all;
    padding: 20px;
    z-index: 20;
}

#startScreen.hidden {
    display: none !important;
}

.game-title h1 {
    font-size: 52px;
    margin-bottom: 5px;
    background: linear-gradient(90deg, #9945FF, #14F195);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
}

.subtitle {
    color: #aaa;
    font-size: 16px;
    margin-bottom: 20px;
    text-align: center;
}

.features {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.features span {
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 13px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ccc;
}

.hint {
    margin-top: 15px;
    font-size: 13px;
    color: #666;
    text-align: center;
}

/* ============================================
   GAME OVER SCREEN
   ============================================ */
#gameOverScreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    pointer-events: all;
    z-index: 30;
}

#gameOverScreen:not(.hidden) {
    display: flex !important;
}

.game-over-content {
    text-align: center;
    padding: 30px;
    width: 100%;
    max-width: 350px;
}

.game-over-content h2 {
    font-size: 32px;
    color: #ff2d55;
    margin-bottom: 15px;
}

.stats p {
    font-size: 18px;
    margin: 6px 0;
    color: #ddd;
}

.stats span {
    font-weight: bold;
    color: #fff;
}

#earnedDisplay {
    color: #14F195;
    font-size: 20px;
    margin: 10px 0;
}

#earnedDisplay span {
    color: #14F195;
    font-weight: bold;
}

#earnedDisplay.hidden {
    display: none !important;
}

.claim-message {
    background: rgba(255, 217, 61, 0.1);
    border: 1px solid rgba(255, 217, 61, 0.3);
    padding: 12px;
    border-radius: 10px;
    color: #ffd93d;
    font-size: 15px;
    margin: 12px 0;
}

.rewarded-message {
    background: rgba(20, 241, 149, 0.1);
    border: 1px solid rgba(20, 241, 149, 0.3);
    padding: 12px;
    border-radius: 10px;
    color: #14F195;
    font-size: 15px;
    margin: 12px 0;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

/* Claim Section */
#claimSection {
    margin: 10px 0;
}

#claimSection.hidden {
    display: none !important;
}

#rewardedSection {
    margin: 10px 0;
}

#rewardedSection.hidden {
    display: none !important;
}

/* ============================================
   WALLET PROMPT OVERLAY (In-game)
   ============================================ */
#walletPrompt {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    pointer-events: all;
    z-index: 50;
}

#walletPrompt:not(.hidden) {
    display: flex !important;
}

.prompt-content {
    text-align: center;
    padding: 30px;
    background: rgba(26, 26, 46, 0.95);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 320px;
    width: 90%;
}

.prompt-content h3 {
    font-size: 24px;
    margin-bottom: 10px;
    color: #ffd93d;
}

.prompt-content p {
    margin: 8px 0;
    color: #ccc;
}

.prompt-content .small {
    font-size: 13px;
    color: #888;
}

.prompt-content .btn-primary {
    margin-top: 15px;
    width: 100%;
}

.prompt-content .btn-text {
    margin-top: 8px;
    display: block;
    width: 100%;
}

#promptTokens {
    color: #14F195;
    font-weight: bold;
    font-size: 24px;
}

/* ============================================
   NOTIFICATION
   ============================================ */
.notification {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 15px 30px;
    border-radius: 15px;
    font-weight: 600;
    z-index: 2000;
    animation: slideDown 0.5s ease;
    max-width: 90%;
    text-align: center;
    font-size: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.notification.success {
    background: rgba(20, 241, 149, 0.15);
    border: 1px solid #14F195;
    color: #14F195;
}

.notification.error {
    background: rgba(255, 45, 85, 0.15);
    border: 1px solid #ff2d55;
    color: #ff2d55;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ============================================
   FOOTER
   ============================================ */
footer {
    margin-top: 20px;
    color: #555;
    font-size: 13px;
    text-align: center;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 450px) {
    body {
        padding: 10px;
    }

    header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        border-radius: 12px;
        padding: 12px 15px;
    }

    .logo {
        text-align: center;
        font-size: 20px;
    }

    .header-right {
        justify-content: center;
        flex-wrap: wrap;
    }

    main {
        width: 100%;
        height: 500px;
        border-radius: 12px;
    }

    .game-title h1 {
        font-size: 36px;
    }

    .features {
        gap: 10px;
    }

    .features span {
        font-size: 11px;
        padding: 4px 12px;
    }

    .game-over-content {
        padding: 20px;
    }

    .game-over-content h2 {
        font-size: 28px;
    }

    .btn-primary,
    .btn-secondary,
    .btn-high-stakes,
    .btn-claim {
        padding: 12px 24px;
        font-size: 15px;
        width: 100%;
    }

    #scoreDisplay,
    #energyDisplay {
        font-size: 13px;
        padding: 4px 10px;
        top: 10px;
    }

    .prompt-content {
        padding: 20px;
        margin: 0 15px;
    }

    .prompt-content h3 {
        font-size: 20px;
    }

    .notification {
        top: 70px;
        padding: 12px 20px;
        font-size: 13px;
    }

    /* Wallet Modal Mobile */
    .modal-content {
        padding: 20px;
        margin: 0 10px;
        max-height: 85vh;
    }

    .modal-header h2 {
        font-size: 20px;
    }

    .wallet-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .wallet-option {
        padding: 12px 10px;
        min-height: 80px;
    }

    .wallet-option .wallet-icon {
        font-size: 28px;
    }

    .wallet-option .wallet-name {
        font-size: 12px;
    }

    .wallet-option .wallet-status {
        font-size: 9px;
        padding: 1px 8px;
    }

    .wc-content .qr-container {
        width: 160px;
        height: 160px;
    }

    .wc-instructions {
        font-size: 13px;
        padding: 12px 15px;
    }

    .section-label {
        font-size: 12px;
    }

    .wallet-help {
        font-size: 12px;
    }
}

@media (max-width: 380px) {
    main {
        height: 450px;
    }

    .game-title h1 {
        font-size: 28px;
    }

    .subtitle {
        font-size: 14px;
    }

    .header-right .badge {
        font-size: 10px;
        padding: 3px 8px;
    }

    .btn-connect {
        font-size: 11px;
        padding: 6px 12px;
    }

    #tokenBalance {
        font-size: 11px;
        padding: 3px 8px;
    }

    .wallet-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .wallet-option {
        padding: 10px 8px;
        min-height: 70px;
    }

    .wallet-option .wallet-icon {
        font-size: 24px;
    }

    .wallet-option .wallet-name {
        font-size: 11px;
    }

    .wallet-option .wallet-status {
        font-size: 8px;
        padding: 1px 6px;
    }

    .modal-content {
        padding: 15px;
    }

    .modal-header h2 {
        font-size: 18px;
    }

    .qr-container {
        width: 140px;
        height: 140px;
    }
}

@media (max-width: 320px) {
    .wallet-grid {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    .wallet-option {
        padding: 8px 6px;
        min-height: 60px;
    }

    .wallet-option .wallet-icon {
        font-size: 20px;
    }

    .wallet-option .wallet-name {
        font-size: 10px;
    }
}

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

/* Make sure buttons are clickable */
button {
    cursor: pointer;
}

/* Fix for iOS Safari */
input,
textarea,
button {
    -webkit-appearance: none;
    appearance: none;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Selection color */
::selection {
    background: #9945FF;
    color: #fff;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #1a1a2e;
}

::-webkit-scrollbar-thumb {
    background: #9945FF;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #14F195;
}

/* Loading animation for wallet status */
.wallet-status.checking {
    animation: pulse 1s infinite;
}

/* Safe area for notched phones */
@supports (padding: max(0px)) {
    body {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
        padding-top: max(20px, env(safe-area-inset-top));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
}
