/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #ffffff;
    color: #333333;
    line-height: 1.6;
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 40px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 60px;
    padding: 20px 0;
}

header h1 {
    font-size: 32px;
    margin-bottom: 8px;
    color: #333333;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 16px;
    color: #666666;
    font-weight: 400;
}

/* Connection Status */
.connection-status {
    text-align: center;
    margin-bottom: 40px;
    padding: 12px;
    background-color: #f8f8f8;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid #e0e0e0;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #999999;
    animation: pulse 2s infinite;
}

.status-indicator.connected {
    background-color: #333333;
    animation: none;
}

.status-indicator.error {
    background-color: #666666;
    animation: none;
}

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

/* Game Options */
.game-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin-bottom: 40px;
}

.option-card {
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 24px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.option-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #d0d0d0;
}

.option-card h2 {
    color: #333333;
    margin-bottom: 8px;
    font-size: 18px;
    font-weight: 600;
}

.option-card p {
    color: #666666;
    margin-bottom: 20px;
    font-size: 14px;
}

/* Form Elements */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: #333333;
    font-weight: 500;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    background-color: #ffffff;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    color: #333333;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #333333;
}

.form-group input::placeholder {
    color: #999999;
}

.form-group select {
    width: 100%;
    padding: 10px 12px;
    background-color: #ffffff;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    color: #333333;
    font-size: 14px;
    transition: border-color 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3e%3cpath fill='%23666' d='m2 0-2 2h4zm0 5 2-2H0z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 36px;
}

.form-group select:focus {
    outline: none;
    border-color: #333333;
}

/* Configuration Section */
.config-section {
    margin: 20px 0;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
}

.config-section summary {
    padding: 12px 16px;
    background-color: #f8f8f8;
    color: #333333;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    user-select: none;
    border: none;
    outline: none;
}

.config-section summary:hover {
    background-color: #f0f0f0;
}

.config-section[open] summary {
    border-bottom: 1px solid #e0e0e0;
}

.config-options {
    padding: 16px;
    background-color: #ffffff;
}

.config-options .form-group {
    margin-bottom: 12px;
}

.config-options .form-group:last-child {
    margin-bottom: 0;
}

/* Checkbox Styling */
.checkbox-group {
    position: relative;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: #333333;
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 0;
}

.checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkmark {
    width: 16px;
    height: 16px;
    border: 1px solid #d0d0d0;
    border-radius: 3px;
    background-color: #ffffff;
    margin-right: 10px;
    flex-shrink: 0;
    position: relative;
    transition: all 0.2s;
}

.checkbox-label:hover .checkmark {
    border-color: #333333;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background-color: #333333;
    border-color: #333333;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 7px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Buttons */
.primary-btn {
    width: 100%;
    padding: 12px 20px;
    background-color: #333333;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.primary-btn:hover:not(:disabled) {
    background-color: #555555;
    transform: translateY(-1px);
}

.primary-btn:disabled {
    background-color: #cccccc;
    color: #999999;
    cursor: not-allowed;
    transform: none;
}

/* Info Section */
.info-section {
    background-color: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 32px;
}

.info-section h3 {
    color: #333333;
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 600;
}

.info-section ul {
    list-style: none;
    padding-left: 0;
}

.info-section li {
    margin-bottom: 8px;
    padding-left: 24px;
    position: relative;
    font-size: 14px;
    color: #666666;
}

.info-section li::before {
    content: attr(data-emoji);
    position: absolute;
    left: 0;
}

/* Error Message */
.error-message {
    background-color: #fdf2f2;
    border: 1px solid #f5c6c6;
    border-radius: 6px;
    padding: 12px;
    margin-top: 16px;
    color: #b91c1c;
    display: none;
    font-size: 13px;
}

.error-message.show {
    display: block;
}

/* Success Message */
.success-message {
    background-color: #f0f9f0;
    border: 1px solid #c6f6c6;
    border-radius: 6px;
    padding: 12px;
    margin-top: 16px;
    color: #166534;
    text-align: center;
    font-size: 13px;
}

/* Footer */
footer {
    margin-top: auto;
    text-align: center;
    padding: 20px 0;
    color: #999999;
    font-size: 12px;
}

footer a {
    color: #333333;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #ffffff;
    margin: 5% auto;
    padding: 24px;
    border-radius: 8px;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.modal-content h2 {
    color: #333333;
    margin-bottom: 16px;
    font-size: 18px;
    font-weight: 600;
}

.modal-content h3 {
    color: #333333;
    margin-top: 20px;
    margin-bottom: 8px;
    font-size: 16px;
    font-weight: 500;
}

.modal-content ul {
    margin-left: 20px;
}

.modal-content li {
    margin-bottom: 6px;
    color: #666666;
    font-size: 14px;
}

.modal-content p {
    color: #666666;
    font-size: 14px;
    line-height: 1.5;
}

.close {
    position: absolute;
    right: 16px;
    top: 16px;
    font-size: 24px;
    font-weight: bold;
    color: #999999;
    cursor: pointer;
    transition: color 0.2s;
}

.close:hover {
    color: #333333;
}

/* Keyboard shortcuts */
kbd {
    background-color: #f5f5f5;
    border: 1px solid #d0d0d0;
    border-radius: 3px;
    padding: 2px 6px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 12px;
    color: #333333;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 50%;
    border-top-color: #333333;
    animation: spin 1s ease-in-out infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 24px 16px;
    }
    
    header {
        margin-bottom: 40px;
    }
    
    header h1 {
        font-size: 28px;
    }
    
    .option-card {
        padding: 20px;
    }
    
    .modal-content {
        margin: 10% auto;
        padding: 20px;
        width: 90%;
    }
}