/* CSS Variables */
:root {
    --primary-purple: #a855f7;
    --primary-blue: #3b82f6;
    --primary-green: #10b981;
    --primary-pink: #ec4899;
    --dark-bg: #0f0f0f;
    --dark-card: #1a1a1a;
    --border-color: #333;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-muted: #666;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Orbitron', monospace;
    background: linear-gradient(135deg, var(--dark-bg) 0%, var(--dark-card) 50%, var(--dark-bg) 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
.header {
    background: rgba(26, 26, 26, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.game-icon {
    font-size: 2rem;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 900;
    text-shadow: 0 0 20px var(--primary-purple);
    background: linear-gradient(45deg, var(--primary-purple), var(--primary-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.wallet-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.transparency-link {
    color: var(--primary-green);
    text-decoration: none;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--primary-green);
    border-radius: 6px;
    transition: all 0.3s ease;
}

.transparency-link:hover {
    background: rgba(16, 185, 129, 0.1);
    transform: translateY(-1px);
}

.trustless-link {
    color: #ef4444;
    text-decoration: none;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    border: 1px solid #ef4444;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-weight: bold;
}

.trustless-link:hover {
    background: rgba(239, 68, 68, 0.1);
    transform: translateY(-1px);
}

.wallet-balance {
    background: rgba(168, 85, 247, 0.1);
    border: 1px solid var(--primary-purple);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: bold;
}

.connect-btn, .disconnect-btn {
    background: linear-gradient(45deg, var(--primary-purple), var(--primary-blue));
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.connect-btn:hover, .disconnect-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(168, 85, 247, 0.3);
}

.disconnect-btn {
    background: linear-gradient(45deg, #dc2626, #991b1b);
}

/* Main Content */
.main {
    flex: 1;
    padding: 2rem 0;
}

/* Landing Section */
.landing {
    text-align: center;
    padding: 4rem 0;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 900;
    margin-bottom: 1.5rem;
    text-shadow: 0 0 30px var(--primary-purple);
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    0% { text-shadow: 0 0 20px var(--primary-purple); }
    100% { text-shadow: 0 0 40px var(--primary-purple), 0 0 60px var(--primary-purple); }
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Features */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.feature-card {
    background: rgba(26, 26, 26, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-purple);
    box-shadow: 0 10px 30px rgba(168, 85, 247, 0.2);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--primary-blue);
}

.feature-card p {
    color: var(--text-secondary);
    line-height: 1.5;
}

/* CTA Buttons */
.cta-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.cta-btn, .demo-btn {
    border: none;
    padding: 1rem 3rem;
    font-size: 1.25rem;
    font-weight: bold;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 1px;
    min-width: 280px;
}

.cta-btn {
    background: linear-gradient(45deg, var(--primary-purple), var(--primary-blue));
    color: white;
}

.demo-btn {
    background: linear-gradient(45deg, var(--primary-green), var(--primary-blue));
    color: white;
}

.cta-btn:hover:not(:disabled), .demo-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 35px rgba(168, 85, 247, 0.4);
}

.demo-btn:hover {
    box-shadow: 0 15px 35px rgba(16, 185, 129, 0.4);
}

.cta-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Game Section */
.game-section {
    padding: 2rem 0;
}

.game-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 2rem;
    align-items: start;
}

.game-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.game-container {
    position: relative;
    background: var(--dark-card);
    border: 2px solid var(--primary-purple);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 0 30px rgba(168, 85, 247, 0.3);
}

#tetris-canvas {
    background: var(--dark-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 12px;
}

.game-over, .paused {
    text-align: center;
    color: white;
}

.game-over h3, .paused h3 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--primary-purple);
}

/* Game Stats */
.game-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    width: 100%;
    max-width: 300px;
}

.stat-card {
    background: rgba(26, 26, 26, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-purple);
}

/* Game Mode Indicator */
.game-mode-indicator {
    background: rgba(26, 26, 26, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    width: 100%;
    max-width: 300px;
    margin-bottom: 1rem;
}

.demo-mode {
    border-left: 4px solid var(--primary-green);
    padding-left: 1rem;
}

.competitive-mode {
    border-left: 4px solid var(--primary-purple);
    padding-left: 1rem;
}

.mode-header {
    font-weight: bold;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.demo-mode .mode-header {
    color: var(--primary-green);
}

.competitive-mode .mode-header {
    color: var(--primary-purple);
}

.mode-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.demo-games {
    font-size: 0.75rem;
    color: var(--primary-green);
    font-weight: bold;
}

/* Controls Info */
.controls-info {
    background: rgba(26, 26, 26, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    width: 100%;
    max-width: 300px;
}

.controls-info h4 {
    text-align: center;
    margin-bottom: 0.75rem;
    color: var(--primary-blue);
}

.controls-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Leaderboard */
.leaderboard {
    background: rgba(26, 26, 26, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    height: fit-content;
}

.leaderboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.leaderboard h3 {
    color: var(--primary-purple);
    text-shadow: 0 0 10px var(--primary-purple);
}

.time-remaining {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: monospace;
    color: var(--primary-blue);
}

/* Prize Pool */
.prize-pool {
    background: linear-gradient(45deg, rgba(168, 85, 247, 0.1), rgba(59, 130, 246, 0.1));
    border: 1px solid var(--primary-purple);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

.prize-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.prize-amount {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-purple);
    text-shadow: 0 0 20px var(--primary-purple);
    margin-bottom: 0.5rem;
}

.prize-info {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Current Position */
.current-position {
    background: rgba(168, 85, 247, 0.1);
    border: 1px solid var(--primary-purple);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.position-header {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.position-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.position-score {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--primary-purple);
}

.position-rank {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--primary-blue);
}

/* Demo Mode Notice */
.demo-notice {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--primary-green);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.notice-icon {
    font-size: 1.5rem;
}

.notice-text {
    flex: 1;
}

.notice-title {
    font-weight: bold;
    color: var(--primary-green);
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.notice-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Leaderboard List */
.leaderboard-list {
    max-height: 400px;
    overflow-y: auto;
}

.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.leaderboard-entry:hover {
    background: rgba(168, 85, 247, 0.1);
    border: 1px solid var(--primary-purple);
}

.leaderboard-entry.winner {
    background: linear-gradient(45deg, rgba(255, 215, 0, 0.1), rgba(255, 193, 7, 0.1));
    border: 1px solid #ffd700;
}

.entry-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.entry-rank {
    font-weight: bold;
    min-width: 30px;
    text-align: center;
}

.rank-1 { color: #ffd700; }
.rank-2 { color: #c0c0c0; }
.rank-3 { color: #cd7f32; }

.entry-player {
    font-family: monospace;
    font-size: 0.875rem;
}

.entry-right {
    text-align: right;
}

.entry-score {
    font-weight: bold;
    color: var(--text-primary);
}

.entry-prize {
    font-size: 0.75rem;
    color: var(--primary-green);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--dark-card);
    border: 1px solid var(--border-color);
    margin: 10% auto;
    padding: 0;
    width: 90%;
    max-width: 500px;
    border-radius: 12px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    color: var(--primary-purple);
    margin: 0;
}

.close {
    color: var(--text-secondary);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

/* Payment Modal */
.payment-info {
    margin-bottom: 1.5rem;
}

.payment-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.payment-item:last-child {
    border-bottom: none;
}

.payment-amount, .prize-contribution {
    color: var(--primary-green);
    font-weight: bold;
}

.fee-amount {
    color: var(--text-secondary);
}

.payment-warning {
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.payment-warning p {
    color: #ffc107;
    font-size: 0.875rem;
    margin: 0;
}

.payment-actions, .modal-actions {
    display: flex;
    gap: 1rem;
}

.play-again-options {
    display: flex;
    gap: 0.5rem;
    flex: 1;
}

.cancel-btn, .share-btn {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s ease;
}

.cancel-btn:hover, .share-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.confirm-btn, .play-again-btn, .demo-again-btn, .upgrade-btn {
    flex: 1;
    padding: 0.75rem;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.confirm-btn, .play-again-btn {
    background: linear-gradient(45deg, var(--primary-purple), var(--primary-blue));
}

.demo-again-btn {
    background: linear-gradient(45deg, var(--primary-green), var(--primary-blue));
}

.upgrade-btn {
    background: linear-gradient(45deg, #ffd700, #ff8c00);
}

.confirm-btn:hover, .play-again-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(168, 85, 247, 0.3);
}

.demo-again-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(16, 185, 129, 0.3);
}

.upgrade-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 215, 0, 0.3);
}

/* Game Over Modal */
.final-score-display {
    text-align: center;
    margin-bottom: 2rem;
}

.score-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.score-big {
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary-purple);
    text-shadow: 0 0 20px var(--primary-purple);
    margin-bottom: 0.5rem;
}

.score-rating {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--primary-blue);
}

.game-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.summary-item {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    text-align: center;
}

.summary-item span:first-child {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.summary-item span:last-child {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--primary-purple);
}

.competition-status {
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.competition-status h4 {
    color: #ffc107;
    margin-bottom: 0.5rem;
}

.competition-status p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0;
}

/* Loading */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    text-align: center;
}

.spinner, .spinner-large {
    border: 4px solid rgba(168, 85, 247, 0.3);
    border-left: 4px solid var(--primary-purple);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

.spinner {
    width: 24px;
    height: 24px;
}

.spinner-large {
    width: 60px;
    height: 60px;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Footer */
.footer {
    background: var(--dark-card);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    text-align: center;
    color: var(--text-secondary);
    margin-top: 4rem;
}

.disclaimer {
    font-size: 0.875rem;
    margin-top: 0.5rem;
    color: var(--text-muted);
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .leaderboard-area {
        order: -1;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .features {
        grid-template-columns: 1fr;
    }
    
    .nav {
        flex-direction: column;
        gap: 1rem;
    }
    
    .modal-content {
        margin: 5% auto;
        width: 95%;
    }
    
    .game-stats {
        grid-template-columns: repeat(3, 1fr);
        max-width: 100%;
    }
    
    .controls-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .game-container {
        padding: 10px;
    }
    
    #tetris-canvas {
        width: 200px;
        height: 400px;
    }
}
