/* Modern Terminal Styles */
:root {
    --terminal-bg: #0a0e27;
    --terminal-header: #1a1f3a;
    --terminal-text: #00ff41;
    --terminal-prompt: #00ff41;
    --terminal-input: #ffffff;
    --terminal-border: #00ff41;
    --modal-bg: #1a1f3a;
    --modal-border: #00ff41;
    --hover-bg: #2a3050;
    --accent-color: #00ff41;
    --error-color: #ff0041;
    --warning-color: #ffaa00;
}

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

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--terminal-text);
    overflow: hidden;
}

/* Terminal Container */
.terminal-container {
    width: 90%;
    max-width: 1200px;
    height: 80vh;
    background: var(--terminal-bg);
    border: 2px solid var(--terminal-border);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.3);
    animation: terminalGlow 2s ease-in-out infinite alternate;
}

@keyframes terminalGlow {
    from {
        box-shadow: 0 0 30px rgba(0, 255, 65, 0.3);
    }
    to {
        box-shadow: 0 0 50px rgba(0, 255, 65, 0.5);
    }
}

/* Terminal Header */
.terminal-header {
    background: var(--terminal-header);
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--terminal-border);
}

.terminal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.terminal-icon {
    color: var(--accent-color);
    animation: blink 1s infinite;
}

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

.terminal-controls {
    display: flex;
    gap: 10px;
}

.control {
    width: 15px;
    height: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control.minimize { color: #ffaa00; }
.control.maximize { color: #00ff41; }
.control.close { color: #ff0041; }

.control:hover {
    transform: scale(1.2);
}

/* Terminal Body */
.terminal-body {
    height: calc(100% - 45px);
    display: flex;
    flex-direction: column;
    position: relative;
}

.terminal-output {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    margin-bottom: 0;
    scroll-behavior: smooth;
    /* 确保内容始终可滚动 */
    overflow-y: scroll;
}

/* Ensure output content doesn't get hidden behind input */
.terminal-output::-webkit-scrollbar-track {
    margin-bottom: 10px;
}

/* ASCII Art */
.ascii-art {
    color: var(--accent-color);
    font-size: 12px;
    line-height: 1.2;
    margin-bottom: 20px;
    animation: fadeIn 1s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* System Info */
.system-info {
    font-size: 14px;
    line-height: 1.8;
    margin-bottom: 20px;
}

.info-label {
    color: #00ff41;
    font-weight: bold;
}

.status-connected {
    color: #00ff41;
}

.status-disconnected {
    color: #ff0041;
}

.status-connecting {
    color: #ffaa00;
    animation: pulse 1s infinite;
}

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

/* Terminal Input */
.terminal-input-container {
    display: flex;
    align-items: center;
    padding: 20px;
    background: linear-gradient(to bottom, rgba(26, 31, 58, 0.5), var(--terminal-bg));
    border-top: 1px solid rgba(0, 255, 65, 0.3);
    flex-shrink: 0;
    position: relative;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.5);
}

.prompt {
    color: var(--terminal-prompt);
    margin-right: 10px;
    white-space: nowrap;
}

.terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--terminal-input);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    caret-color: var(--accent-color);
}

.terminal-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

/* Terminal Output Lines */
.output-line {
    margin-bottom: 5px;
    font-size: 14px;
    animation: typewriter 0.5s steps(40, end);
}

@keyframes typewriter {
    from { width: 0; }
    to { width: 100%; }
}

.output-line.error {
    color: var(--error-color);
}

.output-line.success {
    color: var(--accent-color);
}

.output-line.warning {
    color: var(--warning-color);
}

.output-line.info {
    color: #00aaff;
}

.output-line.prompt {
    color: #888;
}

/* Game specific styles */
.output-line.game-action {
    color: #ff6b6b;
    font-weight: bold;
}

.output-line.game-info {
    color: #4ecdc4;
}

.output-line.game-hand {
    color: #ffe66d;
    font-weight: bold;
    font-size: 16px;
}

/* Countdown timer styles */
.countdown-timer {
    background: rgba(0, 255, 65, 0.1);
    border: 1px solid var(--terminal-border);
    border-radius: 5px;
    padding: 10px 15px;
    margin: 10px 0;
    font-size: 16px;
    display: inline-block;
    animation: fadeIn 0.3s ease-in;
    box-shadow: 0 2px 10px rgba(0, 255, 65, 0.2);
}

.countdown-seconds {
    font-weight: bold;
    color: var(--accent-color);
    font-size: 18px;
    margin-left: 5px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--modal-bg);
    border: 2px solid var(--modal-border);
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

.modal-header h2 {
    color: var(--accent-color);
    font-size: 20px;
}

.modal-close {
    font-size: 24px;
    cursor: pointer;
    color: var(--terminal-text);
    transition: all 0.3s ease;
}

.modal-close:hover {
    color: var(--error-color);
    transform: rotate(90deg);
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

/* Custom scrollbar for modal */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: rgba(0, 255, 65, 0.1);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #00ff41;
}

/* Room List */
.room-item {
    background: rgba(0, 255, 65, 0.1);
    border: 1px solid var(--terminal-border);
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.room-item:hover {
    background: var(--hover-bg);
    transform: translateX(10px);
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.5);
}

.room-item.room-running {
    background: rgba(255, 100, 0, 0.1);
    border-color: rgba(255, 100, 0, 0.5);
}

.room-item.room-full {
    background: rgba(255, 0, 65, 0.1);
    border-color: rgba(255, 0, 65, 0.5);
}

.room-item.room-running:hover,
.room-item.room-full:hover {
    transform: none;
    box-shadow: none;
    background: rgba(100, 100, 100, 0.2);
}

.room-name {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
}

.room-info {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

/* Game Type Options */
.game-type-option {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: rgba(0, 255, 65, 0.1);
    border: 1px solid var(--terminal-border);
    border-radius: 10px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.game-type-option:hover {
    background: var(--hover-bg);
    transform: scale(1.02);
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.5);
}

.game-type-option:active {
    transform: scale(0.98);
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.5);
}

.game-icon {
    font-size: 48px;
}

.game-info h3 {
    color: var(--accent-color);
    margin-bottom: 5px;
}

.game-info p {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

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

::-webkit-scrollbar-track {
    background: var(--terminal-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--terminal-border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* Command Suggestions */
.command-suggestions {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    margin-bottom: 5px;
    background: var(--terminal-header);
    border: 1px solid var(--terminal-border);
    border-radius: 5px;
    padding: 10px;
    display: none;
    z-index: 10;
}

.suggestion-item {
    padding: 5px 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.suggestion-item:hover {
    background: var(--hover-bg);
}

.suggestion-item.selected {
    background: var(--hover-bg);
    border-left: 3px solid var(--accent-color);
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0, 255, 65, 0.3);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .terminal-container {
        width: 95%;
        height: 90vh;
    }
    
    .ascii-art {
        font-size: 8px;
    }
    
    .game-icon {
        font-size: 36px;
    }
}