:root {
    --input-type: 'numeric';
    --auto-accept-numeric-input: 'true';
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Pre-game message transitions */
[data-message-type="pre-game"] {
    opacity: 1;
    max-height: 50px;
    margin: 8px 0;
    transition: all 0.3s ease-in-out;
}

[data-message-type="pre-game"].fade-out {
    opacity: 0;
    max-height: 0;
    margin: 0;
    font-size: 0.8em;
    overflow: hidden;
    pointer-events: none;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    width: 100%;
    max-width: 800px;
    min-height: min(600px, 80vh);
    height: calc(100vh - 40px);
    max-height: none;
    display: flex;
    flex-direction: column;
    position: relative;
}

header {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 20px;
    text-align: center;
    transition: padding 2s ease;
    min-height: 55px; /* Based on the computed height shown in devtools */
}

header h1 {
    margin-bottom: 5px;
    font-size: 2rem;
    transition: all 2s ease;
}

header p {
    opacity: 0.9;
    font-size: 1rem;
    max-height: 100px;
    margin-top: 5px;
    transition: all 2s ease;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.chat-output {
    flex: 1;
    padding: 20px 20px 40px 8px; /* Reduced left padding */
    overflow-y: auto;
    background: #222;  /* Dark background for game text */
    border-bottom: 1px solid #333;
    min-height: 0;
    max-height: 100%;
    font-family: 'Consolas', 'Monaco', monospace;
}

.message {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease-in;
}

/* Hide timestamps */
.message .timestamp {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-content {
    padding: 12px 16px;
    border-radius: 8px;
    white-space: pre-wrap;
    line-height: 1.5;
}

/* User input style */
.user-message .message-content {
    background: #222;  /* Same as chat-output background */
    color: #3a97f3;  /* Terminal blue color */
    border: none;
    padding: 4px 8px 4px 0;  /* Match python output padding */
    margin-left: 0;  /* Left align like python output */
    max-width: none;
}

/* Game output style (print statements) */
.python-message .message-content {
    background: #222;  /* Same as chat-output background */
    color: #0f0;  /* Classic terminal green */
    border: none;
    padding: 4px 8px 4px 0;  /* top right bottom left */
}

/* System messages (like "Press Enter to continue...") */
.system-message .message-content {
    background: #333;  /* Slightly lighter than background */
    color: #aaa;  /* Muted color */
    font-style: italic;
    font-size: 0.8em;  /* Slightly smaller than regular text */
    border-left: 4px solid #555;
    padding: 8px 8px;
}

.input-container {
    padding: 15px;
    background: #1a1a1a;  /* Slightly darker than chat background */
    border-top: 2px solid #333;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-group {
    display: flex;
    gap: 10px;
    width: 100%;
}

#user-input {
    flex: 1;
    padding: 8px;
    border: none;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 16px;
    background: #222;
    color: #3a97f3;  /* Terminal blue color */
    outline: none;
    /* Style for numeric input */
    -webkit-appearance: textfield;
    -moz-appearance: textfield;
    appearance: textfield;
}

#user-input:focus {
    outline: none;
}

#user-input:disabled {
    background: #1a1a1a;
    border-color: #333;
    color: #666;
    cursor: not-allowed;
}

#send-button {
    background: #1a1a1a;
    border: 2px solid #0f0;
    border-radius: 8px;
    padding: 12px 25px;
    color: #0f0;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#send-button:hover:not(:disabled) {
    background: #0f0;
    color: #1a1a1a;
}

#send-button:disabled {
    border-color: #333;
    color: #666;
    cursor: not-allowed;
}

.controls {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

#run-script-button, #clear-button {
    padding: 8px 16px;
    border: 2px solid #333;
    border-radius: 6px;
    background: #1a1a1a;
    color: #aaa;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#run-script-button {
    border-color: #0a0;
    color: #0a0;
}

#run-script-button:hover:not(:disabled) {
    background: #0a0;
    color: #1a1a1a;
}

#clear-button {
    border-color: #a00;
    color: #a00;
}

#clear-button:hover {
    background: #a00;
    color: #1a1a1a;
}

button:disabled {
    border-color: #333 !important;
    color: #666 !important;
    cursor: not-allowed !important;
    background: #1a1a1a !important;
}

/* Loading spinner */
.status-bar {
    background: #1a1a1a;
    border-top: 2px solid #333;
    padding: 10px 15px;
    color: #666;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Status running state */
.status-running {
    color: #0f0;  /* Neon green base color */
    text-shadow: 0 0 1px #0f0,    /* Tighter glow */
                0 0 2px #0f0;
    animation: neon-pulse 5s ease-in-out infinite;
}

@keyframes neon-pulse {
    0%, 100% { opacity: 0.8; }    /* Full brightness */
    50% { opacity: 0.5; }      /* Less dim at lowest point */
}

#status {
    color: #0f0;
}

#python-version {
    color: #666;
}

#python-version a {
    color: #4aa;  /* Cyan-ish color that stands out as a link */
    text-decoration: none;
    border-bottom: 1px dotted #4aa;  /* Subtle underline to indicate it's clickable */
    transition: all 0.2s ease;
}

#python-version a:hover {
    color: #0f0;  /* Match the bright green on hover */
    text-shadow: 0 0 2px rgba(0, 255, 0, 0.2);  /* Subtle glow effect */
    border-bottom-color: #0f0;  /* Match the hover color */
}

#python-version a:visited {
    color: #668;  /* Muted blue-gray for visited */
    border-bottom-color: #668;
}

#python-version a:visited:hover {
    color: #0f0;  /* Same hover color for consistency */
    border-bottom-color: #0f0;
}

.loading {
    display: inline-block;
    margin-left: 10px;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0, 255, 0, 0.1);
    border-radius: 50%;
    border-top-color: #0f0;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Scrollbar styling */
.chat-output::-webkit-scrollbar {
    width: 10px;
}

.chat-output::-webkit-scrollbar-track {
    background: #222;
}

.chat-output::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 5px;
}

.chat-output::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Mobile responsive styles */
/* Mobile-first responsive design */
@media screen and (max-width: 600px) {
    /* Container and body adjustments */
    body {
        padding: 5px;  /* Reduce the purple background padding */
    }
    
    .container {
        margin: 0;
        min-height: calc(100vh - 10px);
        border-radius: 8px;
    }

    /* Compact header when game is running */
    header.game-running {
        padding: 12px 10px;  /* Increased from 8px to 12px top/bottom */
    }
    
    header.game-running h1 {
        font-size: 1.3rem;
        margin: 0;  /* Reset margins */
        line-height: 31px;  /* Match the header's min-height */
        height: 31px;  /* Explicit height to match min-height */
    }
    
    header.game-running p {
        opacity: 0;
        margin-top: -20px;
        max-height: 0;
        overflow: hidden;
    }

    /* Header adjustments */
    header {
        padding: 15px 10px;
    }

    header h1 {
        font-size: 1.5rem;
        margin-bottom: 4px;
    }

    header p {
        font-size: 0.9rem;
        line-height: 1.3;
    }

    /* Chat output adjustments */
    .chat-output {
        padding: 10px;
        font-size: 14px;
    }

    .python-message .message-content {
        font-size: 14px;
        line-height: 1.4;
    }

    .system-message .message-content {
        font-size: calc(0.8em * 14px / 16px);  /* Maintain the same relative size as non-mobile */
        padding: 6px 8px;
    }

    /* Input container adjustments */
    .input-container {
        padding: 8px;
        gap: 8px;
    }

    .input-group {
        gap: 6px;
    }

    #user-input {
        padding: 8px 12px;
        font-size: 14px;
        min-height: 36px;
    }

    #send-button {
        padding: 8px 15px;
        font-size: 14px;
        min-width: 60px;
    }

    /* Control buttons adjustments */
    .controls {
        gap: 6px;
        flex-wrap: wrap;
    }

    #run-script-button, #clear-button {
        padding: 6px 12px;
        font-size: 13px;
        flex: 1;
        min-width: 120px;
    }

    /* Status bar adjustments */
    .status-bar {
        padding: 8px 10px;
        font-size: 12px;
    }
}

@media screen and (min-width: 601px) and (max-width: 900px) {
    header h1 {
        font-size: 1.8rem;
    }

    /* Compact header when game is running */
    header.game-running {
        padding: 15px;  /* Slightly more padding */
    }
    
    header.game-running h1 {
        font-size: 1.5rem;
        margin-bottom: 2px;  /* Small margin instead of 0 */
        line-height: 1.2;  /* Ensure enough height for the text */
    }
    
    header.game-running p {
        opacity: 0;
        margin-top: -20px;
        max-height: 0;
        overflow: hidden;
    }

    .python-message .message-content {
        font-size: 15px;
    }

    .system-message .message-content {
        font-size: calc(0.8em * 15px / 16px);  /* Maintain the same relative size */
    }

    .chat-output {
        padding: 15px 15px 30px 15px;
    }

    .input-container {
        padding: 10px;
    }

    #user-input, #send-button {
        font-size: 15px;
        padding: 10px 15px;
    }

    .controls button {
        font-size: 13px;
        padding: 8px 14px;
    }
}





.status-running-rainbox {
  background: linear-gradient(
    45deg,
    #ff0000 0%,
    #ff8000 14.28%,
    #ffff00 28.56%,
    #80ff00 42.84%,
    #00ff00 57.12%,
    #00ff80 71.4%,
    #00ffff 85.68%,
    #0080ff 100%
  );
  background-size: 200% 200%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: rainbow-shift 3s ease-in-out infinite;
  font-weight: 600;
  display: inline-block;
}

@keyframes rainbow-shift {
  0%,
  100% {
    background-position: 0% 0%;
  }
  50% {
    background-position: 100% 100%;
  }
}

/* Fallback for browsers that don't support background-clip: text */
@supports not (background-clip: text) {
  .status-running-rainbox {
    background: none;
    color: #ff6b6b;
    text-shadow: 1px 1px 0 #ff8000, 2px 2px 0 #ffff00, 3px 3px 0 #80ff00, 4px 4px 0 #00ff00;
  }
}
