/**
 * Common styles for AIML Games Framework
 * Shared across all games
 */

/* Framework Common Styles */
.aiml-games-framework {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Loading States */
.aiml-games-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: aiml-games-spin 1s linear infinite;
}

@keyframes aiml-games-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Common Buttons */
.aiml-games-btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 2px;
    background: #0073aa;
    color: #fff;
}

/* Button loading states */
.aiml-games-btn.is-loading .aiml-games-btn-text {
    display: none;
}

.aiml-games-btn.is-loading .aiml-games-btn-loading {
    display: inline;
}

.aiml-games-btn-loading {
    display: none;
}

.aiml-games-btn:hover {
    background: #005a87;
    color: #fff;
}

.aiml-games-btn:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.aiml-games-btn:disabled {
    background: #c3c4c7;
    cursor: not-allowed;
}

.aiml-games-btn-primary {
    background: #0073aa;
    color: #fff;
}

.aiml-games-btn-primary:hover {
    background: #005a87;
}

.aiml-games-btn-secondary {
    background: #f0f0f1;
    color: #1d2327;
    border: 1px solid #c3c4c7;
}

.aiml-games-btn-secondary:hover {
    background: #e9e9ea;
}

.aiml-games-btn-success {
    background: #00a32a;
    color: #fff;
}

.aiml-games-btn-success:hover {
    background: #008a20;
}

.aiml-games-btn-danger {
    background: #d63638;
    color: #fff;
}

.aiml-games-btn-danger:hover {
    background: #b32d2e;
}

.aiml-games-btn-warning {
    background: #dba617;
    color: #fff;
}

.aiml-games-btn-warning:hover {
    background: #c29400;
}

.aiml-games-btn-info {
    background: #72aee6;
    color: #fff;
}

.aiml-games-btn-info:hover {
    background: #4f94d4;
}

.aiml-games-btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.aiml-games-btn-large {
    padding: 14px 28px;
    font-size: 16px;
}

/* Common Form Elements */
.aiml-games-form-group {
    margin-bottom: 20px;
}

.aiml-games-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #1d2327;
}

.aiml-games-input,
.aiml-games-select,
.aiml-games-textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.aiml-games-input:focus,
.aiml-games-select:focus,
.aiml-games-textarea:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
}

/* Error state styling */
.aiml-games-input.aiml-games-error,
.aiml-games-select.aiml-games-error,
.aiml-games-textarea.aiml-games-error {
    border-color: #d63638;
    box-shadow: 0 0 0 2px rgba(214, 54, 56, 0.2);
    margin-top: 0;
}

.aiml-games-input.aiml-games-error:focus,
.aiml-games-select.aiml-games-error:focus,
.aiml-games-textarea.aiml-games-error:focus {
    border-color: #d63638;
    box-shadow: 0 0 0 2px rgba(214, 54, 56, 0.3);
    margin-top: 0;
}

.aiml-games-textarea {
    resize: vertical;
    min-height: 100px;
}

.aiml-games-checkbox,
.aiml-games-radio {
    margin-right: 8px;
}

.aiml-games-help-text {
    font-size: 12px;
    color: #646970;
    margin-top: 5px;
}

/* Common Messages */
.aiml-games-message {
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: 4px;
    border-left: 4px solid;
}

.aiml-games-message-success {
    background: #d4edda;
    color: #155724;
    border-color: #28a745;
}

.aiml-games-message-error {
    background: #f8d7da;
    color: #721c24;
    border-color: #d63638;
}

.aiml-games-message-warning {
    background: #fff3cd;
    color: #856404;
    border-color: #dba617;
}

.aiml-games-message-info {
    background: #d1ecf1;
    color: #0c5460;
    border-color: #72aee6;
}

/* Generic Answer Feedback Classes */
.aiml-games-feedback {
    padding: 8px 12px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.aiml-games-feedback-correct {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.aiml-games-feedback-incorrect {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.aiml-games-feedback-missed {
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
}

.aiml-games-feedback-highlight {
    animation: aiml-games-pulse-green 0.5s ease-in-out;
}

@keyframes aiml-games-pulse-green {
    0% { background-color: transparent; transform: scale(1); }
    50% { background-color: #28a745; transform: scale(1.02); }
    100% { background-color: #d4edda; transform: scale(1); }
}

/* Common Modals */
.aiml-games-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow-y: auto;
    /* Flexbox centering for modal content */
    align-items: center;
    justify-content: center;
}

/* Contained modals - when modal is inside a positioned container */
.ai-fun-games-container .ai-fun-games-modal {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 1000;
    background-color: rgba(0, 0, 0, 0.5);
    overflow-y: auto;
}

/* Sibling modals - when modal is immediately after the game container (common pattern) */
.ai-fun-games-container + .ai-fun-games-modal {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 1000;
    background-color: rgba(0, 0, 0, 0.5);
    overflow-y: auto;
}

/* Contained framework modals - when aiml-games-modal is inside game container */
.ai-fun-games-container .aiml-games-modal,
.aiml-games-container .aiml-games-modal {
    position: absolute !important;
    width: 100%;
    height: 100%;
    min-height: 500px;
    top: 0;
    left: 0;
    z-index: 1000;
    background-color: rgba(0, 0, 0, 0.5);
    overflow-y: auto;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 20px;
}

/* Contained modal content - centered within the modal */
.ai-fun-games-container .ai-fun-games-modal-content,
.aiml-games-container .aiml-games-modal-content {
    margin: 0 auto;
    padding: 20px;
    max-width: 600px;
    width: 100%;
    max-height: calc(100% - 40px);
    position: relative;
    top: 0;
    left: 0;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background-color: #fff;
}

.aiml-games-modal-content {
    background-color: #fff;
    padding: 20px;
    /*border-radius: 8px;*/
    max-width: 600px;
    width: 100%;
    position: relative;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin: auto;
}

.aiml-games-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    /*margin-bottom: 20px;*/
    padding-bottom: 15px;
    border-bottom: 1px solid #c3c4c7;
    flex-shrink: 0;
}

/* Contained modal header - simplified */
.ai-fun-games-container .aiml-games-modal-header {
    padding: 15px;
    margin: 0;
    background-color: #fff;
}

.aiml-games-modal-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.aiml-games-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    color: #646970;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.aiml-games-modal-close:hover {
    background-color: #f0f0f1;
}

.aiml-games-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.aiml-games-modal-footer {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 15px;
    border-top: 1px solid #c3c4c7;
    background-color: #fff;
    flex-shrink: 0;
}

/* Common Tables */
.aiml-games-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.aiml-games-table th,
.aiml-games-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #c3c4c7;
}

.aiml-games-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #1d2327;
}

.aiml-games-table tr:hover {
    background-color: #f8f9fa;
}

.aiml-games-table tr:last-child td {
    border-bottom: none;
}

/* Common Cards */
.aiml-games-card {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.aiml-games-card-header {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #c3c4c7;
}

.aiml-games-card-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1d2327;
}

.aiml-games-card-body {
    margin-bottom: 15px;
}

.aiml-games-card-footer {
    padding-top: 15px;
    border-top: 1px solid #c3c4c7;
}

/* Common Grids */
.aiml-games-grid {
    display: grid;
    gap: 20px;
    margin-bottom: 20px;
}

.aiml-games-grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.aiml-games-grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.aiml-games-grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Common Utilities */
.aiml-games-text-center {
    text-align: center;
}

.aiml-games-text-right {
    text-align: right;
}

.aiml-games-text-left {
    text-align: left;
}

.aiml-games-font-small {
    font-size: 12px;
}

.aiml-games-font-large {
    font-size: 18px;
}

.aiml-games-font-bold {
    font-weight: 600;
}

.aiml-games-margin-top {
    margin-top: 20px;
}

.aiml-games-margin-bottom {
    margin-bottom: 20px;
}

.aiml-games-padding {
    padding: 20px;
}

.aiml-games-hidden {
    display: none;
}

.aiml-games-visible {
    display: block;
}

/* Responsive Design */
@media (max-width: 768px) {
    .aiml-games-modal-content {
        width: 95%;
        margin: 20px auto;
        padding: 15px;
    }
    
    .aiml-games-btn {
        padding: 8px 16px;
        font-size: 14px;
    }
    
    .aiml-games-grid {
        grid-template-columns: 1fr;
    }
    
    .aiml-games-modal-footer {
        flex-direction: column;
    }
    
    .aiml-games-modal-footer .aiml-games-btn {
        width: 100%;
        margin: 2px 0;
    }
    
    /* Save Score Form Responsive Styles */
    .aiml-games-save-score-form {
        padding: 15px;
        margin: 10px 0;
    }
    
    .aiml-games-save-score-form .aiml-games-input {
        max-width: 200px;
    }
    
    .aiml-games-save-score-form .aiml-games-btn {
        width: 100%;
        margin: 10px 0 0 0;
    }
}

@media (max-width: 480px) {
    .aiml-games-table {
        font-size: 12px;
    }
    
    .aiml-games-table th,
    .aiml-games-table td {
        padding: 8px;
    }
    
    .aiml-games-card {
        padding: 15px;
    }
    
    .aiml-games-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    /* Save Score Form Mobile Styles */
    .aiml-games-save-score-form {
        padding: 12px;
        margin: 8px 0;
        border-radius: 4px;
    }
    
    .aiml-games-save-score-form .aiml-games-input {
        max-width: 180px;
        font-size: 14px;
    }
    
    .aiml-games-save-score-form .aiml-games-logged-in-user {
        padding: 8px 10px;
        font-size: 14px;
    }
    
    .aiml-games-save-score-form .aiml-games-btn {
        padding: 8px 16px;
        font-size: 14px;
        min-width: 100px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus indicators for better accessibility */
.aiml-games-btn:focus-visible,
.aiml-games-input:focus-visible,
.aiml-games-select:focus-visible,
.aiml-games-textarea:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Screen reader only text */
.aiml-games-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Save Score Form Styles */
.aiml-games-save-score-form {
    margin: 15px 0;
    padding: 20px;
    background-color: var(--aiml-success-bg, #d4edda);
    border: 1px solid var(--aiml-success-border, #c3e6cb);
    border-radius: 6px;
    /*border-left: 4px solid var(--aiml-success-border-accent, #28a745);*/
    display: none;
}

.aiml-games-save-score-form.aiml-games-visible {
    display: block;
}

.aiml-games-save-score-form .aiml-games-form-group {
    margin-bottom: 15px;
}

.aiml-games-save-score-form .aiml-games-form-group:last-child {
    margin-bottom: 0;
}

.aiml-games-save-score-form .aiml-games-label {
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--aiml-success-text, #155724);
}

.aiml-games-save-score-form .aiml-games-logged-in-user {
    padding: 10px 12px;
    background-color: var(--aiml-surface, #fff);
    border: 1px solid var(--aiml-success-border, #c3e6cb);
    border-radius: 4px;
    font-weight: 600;
    color: var(--aiml-success-text, #155724);
    margin-bottom: 15px;
}

.aiml-games-save-score-form .aiml-games-input {
    background-color: var(--aiml-surface, #fff);
    border-color: var(--aiml-success-border, #c3e6cb);
    margin-bottom: 15px;
    /* max-width: 250px; */
    max-width: 100%;
}

.aiml-games-save-score-form .aiml-games-input:focus {
    border-color: var(--aiml-success-border-accent, #28a745);
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.2);
}

.aiml-games-save-score-form .aiml-games-btn {
    background: var(--aiml-success-border-accent, #28a745);
    border-color: var(--aiml-success-border-accent, #28a745);
    color: #fff;
    font-weight: 600;
    min-width: 120px;
}

.aiml-games-save-score-form .aiml-games-btn:hover {
    background: var(--aiml-success-hover, #218838);
    border-color: var(--aiml-success-hover, #218838);
}

.aiml-games-save-score-form .aiml-games-btn:disabled {
    background: #c3c4c7;
    border-color: #c3c4c7;
    cursor: not-allowed;
}

.aiml-games-save-score-form .aiml-games-btn:disabled:hover {
    background: #c3c4c7;
    border-color: #c3c4c7;
}

/* Email Field Styles */
.aiml-games-email-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.aiml-games-email-checkbox-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.aiml-games-email-checkbox {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
}

.aiml-games-email-checkbox-label {
    font-weight: 500;
    color: #333;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
}

.aiml-games-email-checkbox-label:hover {
    color: #0073aa;
}

.aiml-games-email-field-container {
    opacity: 0;
    max-height: 0;
    margin-top: 0;
    overflow: hidden;
    transition: opacity 0.3s ease, max-height 0.3s ease, margin 0.3s ease;
}

.aiml-games-email-field-container.aiml-games-show {
    opacity: 1;
    max-height: 150px;
    margin-top: 12px;
}

.aiml-games-email-field-container .aiml-games-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.aiml-games-email-input {
    width: 100%;
    padding: 6px 12px;
    font-size: 14px;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.aiml-games-email-input:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
    outline: none;
}

.aiml-games-email-input.aiml-games-error {
    border-color: #d63638;
    background: #fff5f5;
    padding: 6px 12px;
    margin-top: 0;
}

.aiml-games-email-input.aiml-games-error:focus {
    border-color: #d63638;
    box-shadow: 0 0 0 1px #d63638;
    padding: 6px 12px;
    margin-top: 0;
}

.aiml-games-email-help-text {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #666;
    font-style: italic;
}

.aiml-games-email-error-message {
    display: none;
    margin-top: 6px;
    font-size: 12px;
    color: #d63638;
    font-weight: 500;
}

.aiml-games-email-error-message.aiml-games-visible {
    display: block;
}

/* Responsive styles for email field */
@media (max-width: 600px) {
    .aiml-games-email-section {
        margin-top: 12px;
        padding-top: 12px;
    }
    
    .aiml-games-email-checkbox-container {
        margin-bottom: 10px;
    }
    
    .aiml-games-email-checkbox-label {
        font-size: 13px;
    }
    
    .aiml-games-email-input {
        padding: 6px 10px;
        font-size: 13px;
    }
    
    .aiml-games-email-help-text {
        font-size: 11px;
    }
}

/* Save Score Success Message */
.aiml-games-save-score-success {
    padding: 12px 16px;
    margin: 15px 0;
    background: var(--aiml-success-bg, #d4edda);
    color: var(--aiml-success-text, #155724);
    border: 1px solid var(--aiml-success-border, #c3e6cb);
    /*border-left: 4px solid var(--aiml-success-border-accent, #28a745);*/
    border-radius: 4px;
    font-weight: 500;
    display: none;
}

.aiml-games-save-score-success.aiml-games-visible {
    display: block;
}

.aiml-games-save-score-success .aiml-games-success-icon {
    color: var(--aiml-success-border-accent, #28a745);
    margin-right: 8px;
    font-weight: bold;
}

/* Save Score Error Message */
.aiml-games-save-score-error {
    padding: 12px 16px;
    margin: 15px 0;
    background: var(--aiml-error-bg, #f8d7da);
    color: var(--aiml-error-text, #721c24);
    border: 1px solid var(--aiml-error-border, #f5c6cb);
    border-left: 4px solid var(--aiml-error-border-accent, #d63638);
    border-radius: 4px;
    font-weight: 500;
    display: none;
}

.aiml-games-save-score-error.aiml-games-visible {
    display: block;
}

.aiml-games-save-score-error .aiml-games-error-icon {
    color: var(--aiml-error-border-accent, #d63638);
    margin-right: 8px;
    font-weight: bold;
}

/* Save Score Message Container */
.aiml-games-save-score-message {
    margin: 15px 0;
    padding: 0;
    border: none;
    background: none;
    border-radius: 0;
}

.aiml-games-save-score-message .aiml-games-save-score-success,
.aiml-games-save-score-message .aiml-games-save-score-error {
    margin: 0;
    border-radius: 4px;
}
/* Template-Specific Styles for Single Game Post Type */
/* Removed heavy body styling to prevent theme conflicts */

/* Basic layout styles for the game container within the single post context */
.aiml-game-container {
    position: relative; /* Creates positioning context for sibling modal */
    max-width: 850px; /* Optimal width for game content */
    margin: 20px auto; /* Center the game container with vertical spacing */
    padding: 20px;
    background-color: var(--aiml-surface, #fff);
    border: 1px solid var(--aiml-border-color, #e0e0e0);
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--aiml-surface-border, rgba(0, 0, 0, 0.08));
}

/* Enhanced error message styling for consistency and visibility */
.aiml-games-message.aiml-games-message-error {
    background: var(--aiml-error-bg, #fef2f2);
    color: var(--aiml-error-text, #7f1d1d);
    border-color: var(--aiml-error-border, #fca5a5);
    margin-top: 15px;
    margin-bottom: 15px;
    padding: 12px 16px; /* Consistent with general message padding */
    font-size: 14px;
    line-height: 1.5;
}

/* Responsive styles for game containers */
@media (max-width: 1024px) {
    .aiml-game-container {
        max-width: 90%; /* Adjust max-width for slightly smaller screens */
        margin: 25px auto;
        padding: 20px;
    }
}

@media (max-width: 768px) {
    .aiml-game-container {
        max-width: 95%; /* Further adjust max-width for tablets */
        margin: 20px auto;
        padding: 18px;
        border-radius: 6px;
    }
}

@media (max-width: 480px) {
    .aiml-game-container {
        max-width: 100%; /* Full width on small mobile screens */
        margin: 10px 5px; /* Smaller margins on very small screens */
        padding: 15px;
        border-radius: 4px;
        box-shadow: none; /* Reduce shadow on small screens for cleaner look */
        border-left: none;
        border-right: none;
    }
}

/* ============================================
   Save Score Form Updates - Button Group
   ============================================ */

.aiml-games-button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 15px;
}

.aiml-games-btn-secondary {
    background: #6c757d;
    border-color: #6c757d;
    color: #fff;
}

.aiml-games-btn-secondary:hover {
    background: #5a6268;
    border-color: #545b62;
}

.aiml-games-btn-disabled {
    opacity: 0.6;
    cursor: not-allowed !important;
}

.aiml-games-btn-disabled:hover {
    opacity: 0.6;
}

.aiml-games-form-prompt {
    margin-bottom: 20px;
}

.aiml-games-main-prompt {
    font-size: 16px;
    font-weight: 600;
    color: var(--aiml-success-text, #155724);
    display: block;
    margin-bottom: 15px;
}

/* ============================================
   Login Modal Styles
   ============================================ */

.aiml-games-login-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.aiml-games-login-modal-content {
    background: #fff;
    border-radius: 8px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.aiml-games-login-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px 15px;
    border-bottom: 1px solid #e0e0e0;
}

.aiml-games-login-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.aiml-games-login-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.aiml-games-login-modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.aiml-games-login-modal-body {
    padding: 25px;
}

.aiml-games-login-form .aiml-games-form-group {
    margin-bottom: 20px;
}

.aiml-games-login-form .aiml-games-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.aiml-games-login-form .aiml-games-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.aiml-games-login-form .aiml-games-input:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
    outline: none;
}

.aiml-games-login-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 14px;
}

.aiml-games-login-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 25px;
}

.aiml-games-login-submit-btn {
    background: #0073aa;
    border-color: #0073aa;
    position: relative;
}

.aiml-games-login-submit-btn:hover {
    background: #005a87;
    border-color: #005a87;
}

.aiml-games-login-submit-btn:disabled {
    background: #c3c4c7;
    border-color: #c3c4c7;
    cursor: not-allowed;
}

.aiml-games-login-cancel-btn {
    background: #6c757d;
    border-color: #6c757d;
}

.aiml-games-login-cancel-btn:hover {
    background: #5a6268;
    border-color: #545b62;
}

/* Forgot password link styling */
.aiml-games-forgot-password {
    margin-top: 8px;
    text-align: right;
}

.aiml-games-forgot-password-link {
    color: #0073aa;
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s ease;
}

.aiml-games-forgot-password-link:hover {
    color: #005a87;
    text-decoration: underline;
}

/* Responsive adjustments for modal */
@media (max-width: 600px) {
    .aiml-games-login-modal {
        padding: 10px;
    }

    .aiml-games-login-modal-content {
        max-height: 95vh;
    }

    .aiml-games-login-modal-header,
    .aiml-games-login-modal-body {
        padding: 20px;
    }

    .aiml-games-login-buttons {
        flex-direction: column;
    }

    .aiml-games-button-group {
        flex-direction: column;
        align-items: stretch;
    }

    .aiml-games-button-group .aiml-games-btn {
        width: 100%;
        margin-bottom: 10px;
    }
}

/* ============================================
 * Game Mode Selection Modal Styles
 * ============================================ */

.aiml-games-modal-instructions {
    margin: 20px 0;
}

.aiml-games-modal-instructions p {
    margin: 0 0 10px 0;
    font-weight: 600;
}

.aiml-games-modal-instructions ul {
    margin: 10px 0;
    padding-left: 20px;
}

.aiml-games-modal-instructions li {
    margin: 5px 0;
}

.aiml-games-mode-selection {
    margin: 20px 0;
}

.aiml-games-mode-selection h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 16px;
}

.aiml-games-mode-options {
    display: flex;
    flex-direction: row;
    gap: 15px;
    margin: 15px 0;
}

.aiml-games-mode-option {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 15px;
    margin: 0;
    transition: all 0.3s ease;
    cursor: pointer;
    background: #fff;
    flex: 1;
}

.aiml-games-mode-option:hover:not(.disabled) {
    border-color: #0073aa;
    background-color: #f8f9fa;
}

.aiml-games-mode-option.selected {
    border-color: #0073aa;
    background-color: #e7f3ff;
}

.aiml-games-mode-option.disabled {
    opacity: 0.7;
    cursor: not-allowed;
    background-color: #f5f5f5;
}

.aiml-games-mode-option label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    margin: 0;
}

.aiml-games-mode-option input[type="radio"] {
    margin-top: 3px;
    cursor: pointer;
}

.aiml-games-mode-option strong {
    color: #333;
    font-size: 15px;
}

.aiml-games-mode-description {
    color: #666;
    font-size: 13px;
    margin-left: 24px;
    display: block;
}

.aiml-games-mode-locked-info {
    padding: 5px 0;
}

.aiml-games-mode-locked-info strong {
    color: #333;
    font-size: 15px;
    display: block;
}

.aiml-games-mode-locked-info .aiml-games-mode-description {
    color: #666;
    font-size: 13px;
    margin-left: 0;
}

.aiml-games-start-game-btn {
    max-width: 50%;
    padding: 12px 24px;
    font-size: 16px;
    text-align: center;
}

/* Responsive adjustments for mode selection */
@media (max-width: 600px) {
    .aiml-games-mode-option {
        padding: 10px 12px;
    }

    .aiml-games-mode-option strong {
        font-size: 14px;
    }

    .aiml-games-mode-description {
        font-size: 12px;
    }
}

/* ============================================
 * Game Over Dialog Styles
 * ============================================ */

/* Legacy div-based modal (fallback) */
.aiml-games-game-over-dialog:not(dialog) {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.aiml-games-game-over-dialog:not(dialog).visible {
    opacity: 1;
    visibility: visible;
}

/* Native dialog element - visible when open */
dialog.aiml-games-game-over-dialog[open] {
    visibility: visible;
    opacity: 1;
}

/* Game container needs relative positioning for absolute children */
.aiml-games-container {
    position: relative;
}

/* Contained Game Over dialog - when inside game container (legacy div-based only) */
.aiml-games-container .aiml-games-game-over-dialog:not(dialog) {
    position: absolute !important;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 1000;
}

/* Native dialog elements are styled in game-components.css */

.aiml-games-game-over-content {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    position: relative;
}

.aiml-games-game-over-dialog.visible .aiml-games-game-over-content {
    transform: scale(1);
}

.aiml-games-game-over-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #f0f0f1;
    border: none;
    color: #646970;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: background 0.2s ease, color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aiml-games-game-over-close:hover {
    background: #d63638;
    color: #fff;
}

.aiml-games-game-over-title {
    font-size: 28px;
    font-weight: 700;
    color: #1d2327;
    margin: 0 0 8px 0;
}

.aiml-games-game-over-subtitle {
    font-size: 14px;
    color: #646970;
    margin: 0 0 20px 0;
}

.aiml-games-game-over-score-container {
    background: #f6f7f7;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.aiml-games-game-over-score-label {
    font-size: 12px;
    color: #646970;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.aiml-games-game-over-score-value {
    font-size: 42px;
    font-weight: 700;
    color: #2271b1;
    margin: 0;
}

.aiml-games-game-over-stats {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 24px;
    padding: 0 10px;
}

.aiml-games-game-over-stat-item {
    text-align: center;
    flex: 1;
}

.aiml-games-game-over-stat-value {
    font-size: 22px;
    font-weight: 600;
    color: #1d2327;
    display: block;
}

.aiml-games-game-over-stat-label {
    font-size: 11px;
    color: #646970;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
    display: block;
}

.aiml-games-game-over-continue {
    background: #2271b1;
    color: #fff;
    border: none;
    padding: 12px 32px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.aiml-games-game-over-continue:hover {
    background: #135e96;
}

.aiml-games-game-over-continue:active {
    background: #0a4b78;
}

/* Relaxed mode - hide score container */
.aiml-games-game-over-dialog.relaxed-mode .aiml-games-game-over-score-container {
    display: none;
}

/* Game Over Dialog - Responsive */
@media (max-width: 480px) {
    .aiml-games-game-over-content {
        padding: 24px 20px;
        margin: 10px;
    }

    .aiml-games-game-over-title {
        font-size: 24px;
    }

    .aiml-games-game-over-score-value {
        font-size: 36px;
    }

    .aiml-games-game-over-stats {
        gap: 16px;
    }

    .aiml-games-game-over-stat-value {
        font-size: 18px;
    }

    .aiml-games-game-over-stat-label {
        font-size: 10px;
    }
}

/* ============================================
 * Common Game Elements
 * Shared styles used across multiple game types
 * ============================================ */

/* Game Area - centered content area within games */
.aiml-games-game-area {
    text-align: center;
    padding: 40px 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Score Display */
.aiml-games-score-display {
    font-size: 32px;
    margin-bottom: 20px;
}

.aiml-games-score-label {
    color: #666;
}

.aiml-games-score-value {
    font-weight: bold;
    color: #2271b1;
}

/* Sample Words / Definitions Section */
.aiml-games-sample-words {
    margin-top: 30px;
    padding: 20px;
    background: #f5f5f5;
    border-radius: 8px;
    text-align: left;
}

.aiml-games-sample-words h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #666;
    font-size: 14px;
    text-transform: uppercase;
}

.aiml-games-sample-words ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.aiml-games-sample-words li {
    padding: 8px 0;
    border-bottom: 1px solid #e5e5e5;
    transition: all 0.3s ease;
}

.aiml-games-sample-words li:last-child {
    border-bottom: none;
}

/* Answer highlight animation (used when revealing correct answers) */
.aiml-games-answer-highlight {
    background-color: #d4edda !important;
    border-color: #c3e6cb !important;
    padding-left: 12px !important;
    border-radius: 4px;
}

.aiml-games-answer-highlight strong {
    color: #155724 !important;
}

/* Common Game Elements - Responsive */
@media (max-width: 600px) {
    .aiml-games-game-area {
        padding: 20px 15px;
    }

    .aiml-games-score-display {
        font-size: 24px;
    }

    .aiml-games-sample-words {
        padding: 15px;
    }
}

/* =============================================================================
   Scoring Breakdown (Start Game Modal + Game Page)
   ============================================================================= */

/* Modal scoring breakdown */
.aiml-games-dialog-body .aiml-games-scoring-breakdown {
    background: #f8f9fa;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px 16px;
    margin: 12px 0;
}

.aiml-games-dialog-body .aiml-games-scoring-breakdown h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
}

.aiml-games-scoring-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.aiml-games-scoring-list li {
    padding: 4px 0;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.aiml-games-scoring-list li + li {
    border-top: 1px solid #e2e8f0;
    padding-top: 6px;
    margin-top: 2px;
}

.aiml-games-scoring-item-label {
    color: #50575e;
}

.aiml-games-scoring-item-value {
    font-weight: 600;
    color: #1d2327;
    background: #e2e8f0;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

/* Game page scoring breakdown (collapsible details) */
.aiml-games-scoring-breakdown details {
    margin: 8px 0;
}

.aiml-games-scoring-breakdown summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    color: #50575e;
    padding: 8px 0;
    user-select: none;
    list-style: none;
}

.aiml-games-scoring-breakdown summary::-webkit-details-marker {
    display: none;
}

.aiml-games-scoring-breakdown summary::before {
    content: '\25B6';
    display: inline-block;
    margin-right: 6px;
    font-size: 10px;
    transition: transform 0.2s ease;
}

.aiml-games-scoring-breakdown details[open] > summary::before {
    transform: rotate(90deg);
}

/* Start Game Message in modal */
.aiml-games-start-message {
    margin-bottom: 12px;
    padding: 12px;
    background: #f0f7ff;
    border-left: 4px solid #0073aa;
    border-radius: 0 4px 4px 0;
    line-height: 1.5;
}

.aiml-games-start-message p:last-child {
    margin-bottom: 0;
}

.aiml-games-start-message ul,
.aiml-games-start-message ol {
    margin: 8px 0;
    padding-left: 20px;
}

.aiml-games-start-message li {
    margin-bottom: 4px;
}
