/* Main styles for retro terminal */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'VT323', monospace;
    background: #000;
    color: #00ff00;
    overflow: hidden;
    user-select: none;
}

/* CRT Container */
.crt-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(ellipse at center, #0a0a0a 0%, #000000 100%);
}

/* CRT Monitor */
.crt-monitor {
    position: relative;
    width: 90vw;
    max-width: 1200px;
    height: 80vh;
    background: #1a1a1a;
    border-radius: 20px;
    box-shadow: 
        0 0 100px rgba(0, 255, 0, 0.2),
        inset 0 0 50px rgba(0, 0, 0, 0.5);
    padding: 40px;
}

/* CRT Screen */
.crt-screen {
    position: relative;
    width: 100%;
    height: 100%;
    background: #0a0a0a;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 
        inset 0 0 40px rgba(0, 255, 0, 0.1),
        inset 0 0 20px rgba(0, 0, 0, 0.8);
}

/* Terminal Container */
.terminal-container {
    position: relative;
    width: 100%;
    height: 100%;
    padding: 20px;
    overflow: hidden;
    z-index: 10;
}

/* Terminal Output */
#terminal-output {
    height: calc(100% - 40px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 10px;
    scrollbar-width: thin;
    scrollbar-color: #00ff00 #0a0a0a;
}

#terminal-output::-webkit-scrollbar {
    width: 8px;
}

#terminal-output::-webkit-scrollbar-track {
    background: #0a0a0a;
}

#terminal-output::-webkit-scrollbar-thumb {
    background: #00ff00;
    border-radius: 4px;
}

/* Terminal Lines */
.terminal-line {
    line-height: 1.6;
    margin-bottom: 2px;
    white-space: pre-wrap;
    word-wrap: break-word;
    animation: fadeIn 0.1s ease-in;
}

/* ASCII Art styling */
.terminal-line.ascii-art {
    line-height: 1.2;
    letter-spacing: 0;
    font-weight: bold;
    color: #00ff00;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
}

.command-line {
    color: #ffffff;
}

.error-line {
    color: #ff3333;
}

.success-line {
    color: #00ff00;
}

.user-input {
    color: #ffffff;
    font-weight: bold;
    padding-left: 20px;
}

/* Input Line */
.terminal-input-line {
    display: flex;
    align-items: center;
    margin-top: 10px;
    position: relative;
}

.prompt {
    color: #00ff00;
    margin-right: 5px;
}

#terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #ffffff;
    font-family: 'VT323', monospace;
    font-size: 18px;
    outline: none;
    caret-color: transparent;
}

/* Cursor */
.cursor {
    display: inline-block;
    width: 10px;
    height: 20px;
    background: #00ff00;
    animation: blink 1s infinite;
    position: absolute;
    left: var(--cursor-position, 0);
}

@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

/* CRT Effects */
.scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        transparent 50%,
        rgba(0, 0, 0, 0.25) 50%
    );
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 1;
}

.crt-flicker {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(18, 16, 16, 0.1);
    opacity: 0;
    pointer-events: none;
    z-index: 2;
    animation: flicker 0.15s infinite;
}

@keyframes flicker {
    0% { opacity: 0.27861; }
    5% { opacity: 0.34769; }
    10% { opacity: 0.23604; }
    15% { opacity: 0.90626; }
    20% { opacity: 0.18128; }
    25% { opacity: 0.83891; }
    30% { opacity: 0.65583; }
    35% { opacity: 0.67807; }
    40% { opacity: 0.26559; }
    45% { opacity: 0.84693; }
    50% { opacity: 0.96019; }
    55% { opacity: 0.08594; }
    60% { opacity: 0.20313; }
    65% { opacity: 0.71988; }
    70% { opacity: 0.53455; }
    75% { opacity: 0.37288; }
    80% { opacity: 0.71428; }
    85% { opacity: 0.70419; }
    90% { opacity: 0.7003; }
    95% { opacity: 0.36108; }
    100% { opacity: 0.24387; }
}

/* Monitor Bezel */
.monitor-bezel {
    position: absolute;
    bottom: 10px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.monitor-logo {
    font-family: 'Share Tech Mono', monospace;
    font-size: 12px;
    color: #666;
    letter-spacing: 2px;
}

.power-led {
    width: 8px;
    height: 8px;
    background: #00ff00;
    border-radius: 50%;
    box-shadow: 0 0 10px #00ff00;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.monitor-button {
    background: #2a2a2a;
    border: 1px solid #444;
    color: #888;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
}

.monitor-button:hover {
    background: #333;
    color: #aaa;
    border-color: #555;
}

/* Boot Sequence */
.boot-sequence {
    color: #00ff00;
    font-size: 16px;
    line-height: 1.6;
}

/* ASCII Art */
.ascii-art {
    color: #00ff00;
    font-size: 14px;
    line-height: 1.2;
    white-space: pre;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Matrix Effect */
.matrix-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.1;
    z-index: 0;
}

/* Color Themes */
body.amber {
    color: #ffb000;
}

body.amber .crt-screen {
    box-shadow: 
        inset 0 0 40px rgba(255, 176, 0, 0.1),
        inset 0 0 20px rgba(0, 0, 0, 0.8);
}

body.amber .terminal-line,
body.amber .success-line,
body.amber .prompt,
body.amber .cursor,
body.amber .ascii-art,
body.amber .boot-sequence {
    color: #ffb000;
}

body.amber .power-led {
    background: #ffb000;
    box-shadow: 0 0 10px #ffb000;
}

body.white {
    color: #ffffff;
}

body.white .crt-screen {
    box-shadow: 
        inset 0 0 40px rgba(255, 255, 255, 0.1),
        inset 0 0 20px rgba(0, 0, 0, 0.8);
}

body.white .terminal-line,
body.white .success-line,
body.white .prompt,
body.white .cursor,
body.white .ascii-art,
body.white .boot-sequence {
    color: #ffffff;
}

body.white .power-led {
    background: #ffffff;
    box-shadow: 0 0 10px #ffffff;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .crt-monitor {
        width: 95vw;
        height: 90vh;
        padding: 20px;
    }
    
    .terminal-container {
        padding: 10px;
    }
    
    #terminal-input {
        font-size: 16px;
    }
    
    .monitor-bezel {
        bottom: 5px;
        right: 10px;
        gap: 10px;
    }
    
    .monitor-button {
        padding: 3px 8px;
        font-size: 10px;
    }
}

/* Wallet Display */
.wallet-display {
    background: rgba(0, 255, 0, 0.1);
    border: 1px solid #00ff00;
    padding: 10px;
    margin: 10px 0;
    border-radius: 5px;
    font-family: 'VT323', monospace;
}

.wallet-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 5px 0;
}

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

.wallet-address {
    font-family: 'Share Tech Mono', monospace;
    font-size: 14px;
    opacity: 0.8;
}

/* QR Code Container */
.qr-container {
    display: inline-block;
    padding: 20px;
    background: #fff;
    border-radius: 10px;
    margin: 20px 0;
}

/* Button Styles */
.terminal-button {
    background: transparent;
    border: 1px solid #00ff00;
    color: #00ff00;
    padding: 10px 20px;
    margin: 5px;
    cursor: pointer;
    font-family: 'VT323', monospace;
    font-size: 18px;
    transition: all 0.3s;
}

.terminal-button:hover {
    background: #00ff00;
    color: #000;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
}

/* Loading Animation */
.loading {
    display: inline-block;
    animation: loading 1s infinite;
}

@keyframes loading {
    0% { content: '.'; }
    33% { content: '..'; }
    66% { content: '...'; }
}

/* Transaction Status */
.tx-pending {
    color: #ffb000;
}

.tx-success {
    color: #00ff00;
}

.tx-error {
    color: #ff3333;
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    
    .crt-monitor {
        width: 100%;
        height: 100vh;
        border-radius: 0;
        box-shadow: none;
    }
    
    .crt-screen {
        border-radius: 0;
        padding: 10px;
    }
    
    .terminal-container {
        font-size: 14px;
        line-height: 1.4;
    }
    
    #terminal-output {
        font-size: 14px;
        padding: 10px;
    }
    
    .terminal-input-line {
        font-size: 14px;
    }
    
    /* Hide monitor bezel on mobile */
    .monitor-bezel {
        display: none;
    }
    
    /* Adjust QR code size for mobile */
    .qr-inline-container {
        max-width: 90%;
        margin: 10px auto;
    }
    
    .qr-inline-container canvas,
    .qr-inline-container img {
        max-width: 150px !important;
        height: auto !important;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 12px;
    }
    
    .terminal-container,
    #terminal-output,
    .terminal-input-line {
        font-size: 12px;
    }
    
    /* Even smaller QR codes on very small screens */
    .qr-inline-container canvas,
    .qr-inline-container img {
        max-width: 120px !important;
    }
}

/* Game Container Styles */
.game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: none;
    flex-direction: column;
}

.game-container.active {
    display: flex;
}

body.game-active {
    overflow: hidden;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: #000;
    border-bottom: 2px solid #0f0;
}

.game-title {
    font-family: monospace;
    font-size: 20px;
    color: #0f0;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.game-exit {
    background: none;
    border: 1px solid #0f0;
    color: #0f0;
    font-family: monospace;
    font-size: 14px;
    padding: 5px 15px;
    cursor: pointer;
    transition: all 0.3s;
}

.game-exit:hover {
    background: #0f0;
    color: #000;
    box-shadow: 0 0 10px #0f0;
}

.game-canvas-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 30px;
    position: relative;
    overflow: hidden;
}

.game-canvas {
    background: #000;
    border: 2px solid #0f0;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
    max-width: 90%;
    max-height: 90%;
}

/* Touch Controls */
.game-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100%;
    pointer-events: none;
    display: none;
}

.touch-left,
.touch-right {
    position: absolute;
    width: 50%;
    height: 50%;
    bottom: 0;
    pointer-events: all;
    opacity: 0;
    transition: opacity 0.3s;
}

.touch-left {
    left: 0;
}

.touch-right {
    right: 0;
}

.touch-left:active,
.touch-right:active {
    opacity: 0.1;
    background: #0f0;
}

/* Show touch controls on mobile */
@media (hover: none) and (pointer: coarse) {
    .game-controls {
        display: block;
    }
    
    .touch-left::before {
        content: '↑';
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        font-size: 48px;
        color: #0f0;
        opacity: 0.2;
    }
    
    .touch-right::before {
        content: '↓';
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        font-size: 48px;
        color: #0f0;
        opacity: 0.2;
    }
}

/* Mobile Game Styles */
@media (max-width: 768px) {
    .game-header {
        padding: 10px;
    }
    
    .game-title {
        font-size: 16px;
    }
    
    .game-exit {
        font-size: 12px;
        padding: 5px 10px;
    }
    
    .game-canvas-wrapper {
        padding: 15px;
    }
    
    .game-canvas {
        border-width: 2px;
        max-width: 95%;
        max-height: 95%;
    }
}