:root {
    --primary-color: #3498db; /* Bright Blue */
    --secondary-color: #f1c40f; /* Sunflower Yellow */
    --accent-color: #e74c3c; /* Pomegranate Red */
    --success-color: #2ecc71; /* Emerald Green */
    --danger-color: #e74c3c; /* Pomegranate Red */
    --dark-color: #34495e; /* Wet Asphalt */
    --light-color: #ecf0f1; /* Clouds */
    --card-bg: #ffffff; /* White */
    --shadow-color: rgba(0, 0, 0, 0.1);
    --border-radius: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Fredoka', sans-serif;
    background: url('../background.svg') center center / cover no-repeat fixed;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
}

/* Ensure all text elements use the same font family, but exclude Font Awesome icons */
*:not(i):not([class*="fa"]), 
*::before:not([class*="fa"]), 
*::after:not([class*="fa"]) {
    font-family: 'Fredoka', sans-serif !important;
}

/* Ensure Font Awesome icons use their proper font */
i[class*="fa"] {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Pro", "Font Awesome 6 Brands" !important;
}

/* CRITICAL: Ensure ALL buttons have visible text */
button, 
.btn, 
[class*="-btn"], 
input[type="button"], 
input[type="submit"] {
    color: var(--dark-color) !important;
    font-weight: 700 !important;
    font-size: 16px !important;
    min-height: 44px;
    padding: 12px 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px;
    border: 2px solid transparent;
    text-shadow: none;
    background-color: white;
}

/* Ensure text is visible in all button children */
button span,
.btn span,
[class*="-btn"] span,
button > *:not(i),
.btn > *:not(i),
[class*="-btn"] > *:not(i) {
    color: inherit !important;
    font-weight: inherit !important;
    display: inline-block !important;
    visibility: visible !important;
}

/* White text for dark backgrounds */
button[class*="play"],
.play-btn,
.confirm-btn,
.guess-character-btn,
button[style*="background-color: rgb"],
button[style*="background: linear-gradient"] {
    color: white !important;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5) !important;
}

/* Custom cursor for all interactive elements */
button, 
.btn, 
[class*="-btn"], 
a, 
.clickable,
.character-card,
.question-btn {
    cursor: pointer;
}

button:hover,
.btn:hover,
[class*="-btn"]:hover {
    cursor: pointer;
}

/* High contrast for important buttons */
.menu-btn {
    border: 3px solid var(--primary-color) !important;
    background: white !important;
    color: var(--dark-color) !important;
}

.random-name-btn {
    background: var(--secondary-color) !important;
    border: 2px solid #f39c12 !important;
    color: var(--dark-color) !important;
}

.question-btn {
    border: 2px solid var(--primary-color) !important;
    color: var(--dark-color) !important;
    background: white !important;
}

/* Input fields visibility */
input, textarea, select {
    color: var(--dark-color) !important;
    background: white !important;
    border: 2px solid var(--primary-color) !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    padding: 12px 16px !important;
}

input::placeholder {
    color: #666 !important;
    opacity: 0.8 !important;
}

/* Labels and text visibility */
label, span, p, div, h1, h2, h3, h4, h5, h6 {
    color: var(--dark-color);
    font-weight: 600;
}

/* Ensure button text is always visible */
button:not(:empty),
.btn:not(:empty),
[class*="-btn"]:not(:empty) {
    font-size: 16px !important;
    line-height: 1.2 !important;
    min-height: 36px !important;
}

/* Special cases for light backgrounds */
.light-bg, .light-color {
    color: var(--dark-color) !important;
}

/* Character Preview Modal */
.character-preview-dialog {
    max-width: 600px;
    width: 90%;
}

#characterPreviewModal .modal-content {
    max-width: 600px;
    width: 90%;
    padding: 25px;
}

.character-preview-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--light-color);
}

.character-preview-title {
    color: var(--primary-color);
    font-size: 24px;
    margin: 0;
    font-weight: 700;
}

.modal-close-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close-btn:hover {
    background: var(--dark-color);
    transform: scale(1.1);
}

.character-preview-content {
    display: flex;
    gap: 25px;
    margin-bottom: 25px;
}

.character-preview-image {
    flex-shrink: 0;
}

.character-preview-image img {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 15px;
    border: 3px solid var(--primary-color);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.character-preview-details {
    flex: 1;
}

.character-preview-details h4 {
    color: var(--dark-color);
    margin-bottom: 15px;
    font-size: 18px;
}

.character-attributes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.character-attribute {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 8px 12px;
    background: var(--light-color);
    border-radius: 10px;
    font-size: 12px;
    border: 1px solid rgba(52, 152, 219, 0.2);
}

.character-attribute strong {
    color: var(--primary-color);
    font-size: 11px;
    text-transform: uppercase;
    margin-bottom: 4px;
    display: block;
}

.character-attribute.positive {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724;
}

.character-attribute.negative {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    color: #721c24;
}

.character-attribute-icon {
    font-size: 16px;
}

.character-preview-description {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    padding: 15px;
    border-radius: 12px;
    border-left: 4px solid var(--primary-color);
}

.character-preview-description p {
    margin: 0;
    color: var(--dark-color);
    font-size: 14px;
    line-height: 1.4;
}

.character-preview-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.character-preview-buttons .modal-btn {
    flex: 1;
    max-width: 180px;
}

.modal-secondary {
    background: var(--light-color);
    color: var(--dark-color);
    border: 2px solid var(--primary-color);
}

.modal-secondary:hover {
    background: var(--primary-color);
    color: white;
}

.modal-primary {
    background: linear-gradient(135deg, var(--success-color), #27ae60);
    color: white;
    border: 2px solid var(--success-color);
}

.modal-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(46, 204, 113, 0.4);
}

#app {
    width: 100%;
    max-width: 100vw;
    margin: 0 auto;
    padding: clamp(10px, 2vw, 20px);
    padding-bottom: 20px; /* Reduced space for footer */
    overflow-x: hidden;
    min-height: calc(100vh - 20px); /* Account for footer height */
}

.screen {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

.screen.active {
    display: block;
}

/* Start screen specific - for footer positioning */
#startScreen {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.hidden {
    display: none !important;
}

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

/* Language Toggle and Rules Button */
.language-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 1000;
    background: white;
    padding: 8px;
    border-radius: 30px;
    box-shadow: 0 4px 15px var(--shadow-color);
}

.rules-btn {
    padding: 12px;
    border: none;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white !important;
    cursor: pointer;
    border-radius: 50%;
    font-weight: 700;
    transition: var(--transition);
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.rules-btn i {
    color: white !important;
}

.rules-btn:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

.fullscreen-btn {
    padding: 12px;
    border: none;
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white !important;
    cursor: pointer;
    border-radius: 50%;
    font-weight: 700;
    transition: var(--transition);
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    box-shadow: 0 4px 15px rgba(44, 62, 80, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.fullscreen-btn i {
    color: white !important;
    transition: var(--transition);
}

.fullscreen-btn:hover {
    background: linear-gradient(135deg, #34495e, #2c3e50);
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 6px 20px rgba(44, 62, 80, 0.4);
}

.fullscreen-btn.fullscreen-active {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
}

.fullscreen-btn.fullscreen-active:hover {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.4);
}



.lang-btn {
    padding: 12px;
    border: none;
    background: rgba(255, 255, 255, 0.8);
    color: var(--dark-color) !important;
    cursor: pointer;
    border-radius: 50%;
    font-weight: 600;
    transition: var(--transition);
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 2px solid rgba(0, 0, 0, 0.1);
}

.lang-btn i {
    color: var(--dark-color) !important;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.lang-btn.active {
    background: var(--primary-color);
    color: white !important;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.lang-btn.active i {
    color: white !important;
}

.lang-btn:hover:not(.active) {
    background: var(--light-color);
}

/* Start Screen */
.game-title {
    text-align: center;
    margin-bottom: 20px;
    animation: bounce 1s ease-in-out;
}

.title-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.title-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    animation: float 3s ease-in-out infinite;
    object-fit: cover;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.title-text {
    font-size: 72px;
    font-weight: 700;
    background: linear-gradient(135deg, 
        #f0c8f0 0%, 
        #ffb3d9 25%, 
        #ffd699 50%, 
        #80e6e6 75%, 
        #e6ccf0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    margin-bottom: 10px;
    letter-spacing: -2px;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
    position: relative;
}

.title-text::before {
    content: '';
    position: absolute;
    top: -15px;
    left: -30px;
    right: -30px;
    bottom: -15px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 25px;
    z-index: -1;
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}



/* Menu Buttons */
.menu-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    max-width: 600px;
    margin: 0 auto;
}

/* Single Row Layout for Main Menu */
.menu-grid-single-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: clamp(20px, 2.5vw, 30px);
    width: 90%;
    max-width: 1000px;
    margin: 0 auto;
    align-items: stretch;
    justify-items: stretch;
    justify-content: center;
}

.menu-btn-square {
    width: 100%;
    aspect-ratio: 1 / 1;
    padding: clamp(15px, 2.5vw, 25px);
    background: white;
    border: none;
    border-radius: 35px;
    font-size: 16px;
    font-weight: 600;
    color: var(--dark-color);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    gap: clamp(10px, 1.5vw, 18px);
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
    border: 3px solid transparent;
    min-width: 150px;
    min-height: 150px;
    max-width: 220px;
    isolation: isolate;
}

.menu-btn-square:hover {
    transform: translateY(-8px) scale(1.05);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    border-color: rgba(255, 255, 255, 0.3);
}

.menu-btn-square:active {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.btn-icon-large {
    font-size: clamp(2.5rem, 6vw, 4rem);
    margin: 0;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 50px;
    min-height: 50px;
    text-align: center;
    transition: var(--transition);
    position: relative;
    padding: clamp(10px, 2vw, 25px);
    background: rgba(255, 255, 255, 0.15);
    border-radius: 25px;
    backdrop-filter: blur(5px);
}

.menu-btn-square:hover .btn-icon-large {
    transform: scale(1.2) rotate(10deg);
    background: rgba(255, 255, 255, 0.2);
}

.btn-text {
    font-size: clamp(16px, 2.5vw, 20px);
    font-weight: 700;
    text-align: center;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: var(--transition);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
    word-break: keep-all;
    overflow: visible;
    width: 100%;
    flex: 0 0 auto;
    padding: 0 10px;
}

.menu-btn-square:hover .btn-text {
    transform: scale(1.05);
}

/* Square Button Specific Styles with Modern Gradients */
.menu-btn-square.solo-mode-btn {
    background: linear-gradient(145deg, #667eea 0%, #764ba2 100%);
    color: white !important;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.menu-btn-square.team-mode-btn {
    background: linear-gradient(145deg, #f093fb 0%, #f5576c 100%);
    color: white !important;
    box-shadow: 0 10px 30px rgba(245, 87, 108, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.menu-btn-square.tutorial-btn {
    background: linear-gradient(145deg, #fa709a 0%, #fee140 100%);
    color: white !important;
    box-shadow: 0 10px 30px rgba(250, 112, 154, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.menu-btn-square.editor-mode-btn {
    background: linear-gradient(145deg, #4facfe 0%, #00f2fe 100%);
    color: white !important;
    box-shadow: 0 10px 30px rgba(79, 172, 254, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.menu-btn-square .btn-icon-large,
.menu-btn-square .btn-text,
.menu-btn-square .btn-icon-large i,
.menu-btn-square .btn-text span {
    color: white !important;
    position: relative;
    z-index: 2;
}

.menu-btn-square.solo-mode-btn::before,
.menu-btn-square.team-mode-btn::before,
.menu-btn-square.tutorial-btn::before,
.menu-btn-square.editor-mode-btn::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(60deg, 
        transparent 40%, 
        rgba(255, 255, 255, 0.4) 50%, 
        transparent 60%);
    transform: rotate(45deg) translateX(-100%);
    animation: shimmer 8s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}

/* Staggered animation delays for natural shimmer effect */
.menu-btn-square.solo-mode-btn::before {
    animation-delay: 0s;
}

.menu-btn-square.team-mode-btn::before {
    animation-delay: 3s;
}

.menu-btn-square.tutorial-btn::before {
    animation-delay: 6s;
}

.menu-btn-square.editor-mode-btn::before {
    animation-delay: 9s;
}

/* Badge positioning for square buttons */
.menu-btn-square .badge-new {
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    font-size: 9px;
    font-weight: 800;
    padding: 5px 10px;
    border-radius: 20px;
    z-index: 3;
    text-transform: uppercase;
    letter-spacing: 1px;
    animation: pulse 2s ease-in-out infinite;
    box-shadow: 0 4px 15px rgba(238, 90, 36, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.4);
    border: 2px solid white;
    /* Ensure badge doesn't affect flexbox layout */
    align-self: auto;
    flex: none;
}

.menu-btn, .win-btn, .control-btn {
    width: 100%;
    padding: 20px 30px;
    background: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 20px;
    font-weight: 600;
    color: var(--dark-color);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 8px 20px var(--shadow-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.menu-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 30px var(--shadow-color);
}

.play-btn {
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    color: white;
}

.btn-icon, .diff-icon, .rule-icon {
    font-size: 28px;
}

/* Special styling for editor button in main menu */
/* Old .menu-btn.editor-btn styles removed - now using .menu-btn-square.editor-btn */

@keyframes shimmer {
    0% { 
        transform: rotate(45deg) translateX(-150%);
    }
    100% { 
        transform: rotate(45deg) translateX(150%);
    }
}

/* Old .menu-btn.editor-btn icon and badge styles removed */

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Difficulty Modal */
.difficulty-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: var(--border-radius);
    max-width: 400px;
    width: 90%;
    animation: slideUp 0.3s ease-out;
}

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

.modal-content h2 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--dark-color);
    font-size: 28px;
}

.difficulty-btn {
    width: 100%;
    padding: 18px;
    margin-bottom: 15px;
    background: var(--light-color);
    border: 3px solid transparent;
    border-radius: 15px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.difficulty-btn:hover {
    border-color: var(--primary-color);
    transform: translateX(5px);
}

.close-modal {
    width: 100%;
    padding: 12px;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: var(--transition);
}

.close-modal:hover {
    background: #c0392b; /* Darker Red */
}

/* Rules Screen */
.rules-container {
    background: white;
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px var(--shadow-color);
    max-width: 700px;
    margin: 0 auto;
}

.rules-container h2 {
    color: var(--primary-color);
    font-size: 36px;
    margin-bottom: 30px;
    text-align: center;
}

.rule-item {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--light-color);
    border-radius: 15px;
}

.rule-item p {
    font-size: 18px;
    color: var(--dark-color);
    line-height: 1.6;
}

.scoring-info {
    margin-top: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #f1c40f20, #2ecc7120); /* Yellow to Green Gradient */
    border-radius: 15px;
}

.scoring-info h3 {
    color: var(--dark-color);
    margin-bottom: 15px;
    font-size: 24px;
}

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

.scoring-info li {
    padding: 8px 15px;
    margin-bottom: 8px;
    background: white;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
}

.back-btn, .confirm-btn {
    margin-top: 30px;
    padding: 15px 30px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.back-btn:hover, .confirm-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(52, 152, 219, 0.4);
}

/* Character Selection */
.selection-container, .teacher-container, .team-names-container, .player-name-container {
    background: white;
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px var(--shadow-color);
}

/* Player Name Specific Styles (Solo Mode) */
.player-name-container {
    max-width: 500px;
    margin: 0 auto;
    text-align: center;
}

.player-name-title {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.player-name-title i {
    font-size: 2rem;
    color: var(--secondary-color);
}

.player-name-instruction {
    color: #666;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.player-name-input-group {
    margin: 2rem 0;
}

.player-name-input {
    width: 80%;
    padding: 1rem;
    font-size: 1.2rem;
    border: 3px solid var(--primary-color);
    border-radius: 10px;
    text-align: center;
    background: var(--light-color);
    font-weight: 600;
    color: var(--dark-color);
}

.player-name-input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 10px rgba(241, 196, 15, 0.3);
}

/* Team Names Specific Styles */
.team-names-container {
    max-width: 600px;
    margin: 0 auto;
}

.team-name-inputs {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 30px 0;
}

.team-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--light-color);
    padding: 15px;
    border-radius: 15px;
}

.team-input-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--dark-color);
    min-width: 160px;
}

.team-name-input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid var(--primary-color);
    border-radius: 10px;
    font-size: 16px;
    font-family: 'Fredoka', sans-serif;
    background: white;
}

.team-name-input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 10px rgba(241, 196, 15, 0.3);
}

.random-name-btn {
    padding: 10px 15px;
    background: var(--secondary-color);
    color: var(--dark-color);
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.random-name-btn:hover {
    background: var(--accent-color);
    color: white;
    transform: scale(1.05);
}

.selection-title, .teacher-title, .team-names-title {
    text-align: center;
    color: var(--dark-color);
    margin-bottom: 30px;
    font-size: 28px;
}

.teacher-instruction, .team-names-instruction {
    text-align: center;
    color: var(--dark-color);
    margin-bottom: 20px;
    font-size: 18px;
    opacity: 0.8;
}

/* Random Selection Toggle */
.random-selection-toggle {
    text-align: center;
    margin: 20px 0;
}

.random-btn {
    background: linear-gradient(135deg, var(--secondary-color), #f39c12);
    color: var(--dark-color);
    border: none;
    padding: 12px 20px;
    border-radius: 15px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(241, 196, 15, 0.3);
    margin-bottom: 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.random-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(241, 196, 15, 0.4);
}

.random-btn:active {
    transform: translateY(0);
}

.random-btn i {
    font-size: 18px;
}

.toggle-label {
    display: inline-block;
    color: var(--dark-color);
    font-size: 14px;
    opacity: 0.7;
    margin-top: 10px;
}

.character-count {
    display: inline-block;
    font-size: 16px;
    color: var(--primary-color);
    font-weight: 600;
    margin: 10px 5px 0 5px;
}

/* Character Count Selector */
.character-count-selector {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin: 15px 0;
    padding: 15px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 12px;
    border: 2px solid var(--primary-color);
}

.count-label {
    font-size: 16px;
    font-weight: 600;
    color: var(--dark-color);
}

.count-select {
    padding: 8px 15px;
    font-size: 16px;
    font-weight: 600;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    background: white;
    color: var(--dark-color);
    cursor: pointer;
    min-width: 70px;
}

.count-select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.3);
}

.count-description {
    font-size: 16px;
    color: var(--dark-color);
    font-weight: 500;
}

.character-count-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.inline-random-btn {
    margin-left: auto;
    padding: 10px 20px;
    font-size: 14px;
    flex-shrink: 0;
}

/* Sound Toggle Button - matching language toggle style */
.language-toggle .sound-toggle-btn {
    padding: 12px;
    border: none;
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white !important;
    border-radius: 15px;
    width: 48px;
    height: 48px;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease;
    cursor: pointer;
    font-size: 18px;
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
    font-weight: 700;
    margin: 0;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.language-toggle .sound-toggle-btn:hover {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.4);
}

.language-toggle .sound-toggle-btn:active {
    transform: scale(1) translateY(0);
}

.language-toggle .sound-toggle-btn.muted {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    box-shadow: 0 4px 15px rgba(149, 165, 166, 0.3);
}

.language-toggle .sound-toggle-btn.muted:hover {
    background: linear-gradient(135deg, #7f8c8d, #95a5a6);
    box-shadow: 0 6px 20px rgba(149, 165, 166, 0.4);
}

.language-toggle .sound-toggle-btn i {
    font-size: 16px;
    color: white !important;
}

.character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(105px, calc((100% - 110px) / 6)), 1fr));
    column-gap: clamp(10px, 1.5vw, 15px);
    row-gap: clamp(15px, 3vh, 35px); /* Increased vertical spacing between rows */
    padding: clamp(8px, 1.5vw, 15px);
    padding-bottom: clamp(20px, 2.5vh, 30px); /* More generous bottom padding */
    overflow-y: auto;
    overflow-x: hidden; /* Prevent horizontal overflow */
    position: relative;
    height: 100%;
    max-height: 100%; /* Use full container height, not limited by viewport calc */
    box-sizing: border-box; /* Ensure padding is included in height calculations */
    align-content: start; /* Align rows to the top instead of stretching */
}

.character-card {
    background: white;
    border-radius: clamp(8px, 1.2vw, 12px);
    padding: clamp(4px, 0.8vw, 8px);
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
    position: relative;
    box-shadow: 0 2px 6px var(--shadow-color);
    aspect-ratio: 4/5;
    overflow: visible;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: clamp(85px, 10vw, 120px);
    max-height: clamp(105px, 14vw, 145px);
    margin-bottom: 5px;
}

.character-card:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 8px 20px var(--shadow-color);
    border-color: var(--secondary-color);
}

.character-card:hover .character-name {
    background: rgba(52, 152, 219, 0.95);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateX(-50%) scale(1.05);
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.6);
    z-index: 20;
}

.character-card.selected {
    border-color: var(--accent-color);
    background: linear-gradient(135deg, #f1c40f20, #e74c3c20); /* Yellow to Red Gradient */
}

.character-card.selected .character-name {
    background: rgba(243, 156, 18, 0.95);
    border-color: rgba(255, 255, 255, 0.7);
    transform: translateX(-50%) scale(1.08);
    box-shadow: 0 8px 25px rgba(243, 156, 18, 0.7);
    z-index: 25;
}

.character-card.eliminated {
    opacity: 0.3;
    transform: scale(0.9);
    filter: grayscale(100%);
    pointer-events: none;
}

/* Disable clicking on character cards during gameplay */
/* Characters should only be eliminated through questions, not manual clicking */
.game-grid .character-card {
    cursor: not-allowed !important;
}

/* Remove hover effects for game grid cards since they're not clickable */
.game-grid .character-card:hover {
    transform: none !important;
    box-shadow: 0 2px 6px var(--shadow-color) !important;
    border-color: transparent !important;
}

.character-card img {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    object-fit: contain;
    display: block;
    background: white;
}

.character-name {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 8px 16px;
    font-weight: 700;
    font-size: clamp(14px, 1.8vw, 16px);
    border-radius: 25px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
    white-space: nowrap;
    text-align: center;
    line-height: 1.2;
    z-index: 15;
    backdrop-filter: blur(8px);
    border: 3px solid rgba(255, 255, 255, 0.3);
    transition: var(--transition);
    min-width: 80px;
}

.confirm-btn {
    display: block;
    margin: 30px auto 0;
    min-width: 200px;
}

/* Top Navigation Bar - Hidden when using sidebar controls */
.top-nav-bar {
    display: none;
}

/* Active Points Display Layout - removed duplicate rule */

.points-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: center;
    order: 2;
}

/* Removed .inline-controls as buttons are now directly in the active-points-display */

.inline-control-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3498db, #2980b9) !important;
    border: 3px solid rgba(255, 255, 255, 0.9) !important;
    color: white !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 3px 12px rgba(52, 152, 219, 0.4);
    position: relative !important;
    z-index: 999 !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.inline-control-btn:hover {
    background: linear-gradient(135deg, #2980b9, #21618c) !important;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.6);
}

/* Left and right button positioning */
.inline-control-btn.left-btn {
    order: 1;
    flex-shrink: 0;
}

.inline-control-btn.right-btn {
    order: 3;
    flex-shrink: 0;
}

.inline-control-btn i {
    font-size: 14px;
    color: inherit;
}

.nav-icon-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    border: 3px solid rgba(255, 255, 255, 0.9);
    color: white;
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
    padding: 0 !important;
}

.nav-icon-btn:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.5);
}

.nav-icon-btn i {
    font-size: 1.2rem;
    color: inherit !important;
}

/* Game Screen */
.game-header {
    display: none;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 15px 25px;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
    margin-top: 5px; /* Add space for top nav */
    box-shadow: 0 4px 15px var(--shadow-color);
    position: relative;
}

/* Active Points Display */
.active-points-display {
    background: linear-gradient(135deg, var(--success-color), #27ae60);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 30px;
    display: flex !important;
    align-items: center;
    justify-content: space-between !important;
    gap: 0.5rem;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.4);
    animation: pulse 2s infinite;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    width: 100%;
    min-height: 50px;
    overflow: visible !important;
}

/* Solo mode active points centered */
.solo-mode-active {
    position: relative !important;
    top: 0 !important;
    right: 0 !important;
    margin: 0 auto 20px auto !important;
    width: fit-content !important;
}

.active-points-display i {
    font-size: 1.2rem;
    color: var(--secondary-color);
}

.active-points-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: white !important;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

/* Team Scores Display in Sidebar */
.team-scores-display {
    display: flex;
    align-items: center;
    justify-content: space-around;
    flex: 1;
    gap: 10px;
    padding: 0 10px;
}

.team-scores-display.hidden {
    display: none;
}

.team-score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 5px 15px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.2);
    min-width: 80px;
    transition: all 0.3s ease;
}

.team-score-item.active-turn {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

.team-name {
    font-size: 12px;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
}

.team-points {
    font-size: 20px;
    font-weight: 700;
}

.team-turn-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: pulse 2s infinite;
    gap: 5px;
}

.team-turn-indicator.pointing-left #turnArrow {
    transform: rotate(180deg);
}

.round-indicator {
    font-size: 10px;
    background: rgba(255, 255, 255, 0.3);
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
    white-space: nowrap;
}

.solo-mode-display.hidden {
    display: none;
}

.player-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-width: 180px;
}

.player-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.secret-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.score-label, .secret-label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.player-label {
    font-weight: 600;
    color: var(--dark-color);
    font-size: 18px;
}

.score {
    background: var(--secondary-color);
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 20px;
    color: var(--dark-color);
}

.secret-character-mini {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    background: var(--light-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    overflow: hidden;
}

.secret-character-mini img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.turn-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 30px;
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    color: white;
    border-radius: 25px;
    font-weight: 600;
    font-size: 16px;
    animation: pulse 2s infinite;
    text-align: center;
    min-width: 200px;
}

.turn-icon {
    font-size: 24px;
    animation: rotate 2s linear infinite;
}

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

.turn-help {
    font-size: 12px;
    font-weight: 400;
    opacity: 0.9;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Game Area */
.game-area {
    display: grid;
    grid-template-columns: 2fr auto 1fr;
    gap: 0;
    height: calc(100vh - 60px);
    align-items: stretch;
    margin: 10px 0;
    max-width: 100vw;
    overflow: hidden;
}

.characters-section {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: white;
    border-radius: var(--border-radius);
    padding: 15px;
    box-shadow: 0 4px 20px var(--shadow-color);
    overflow: hidden; /* Prevent overflow outside the section */
    box-sizing: border-box;
}

.section-title {
    color: var(--dark-color);
    font-size: 22px; /* Larger for better readability */
    font-weight: 700; /* Bolder for kids */
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 12px 16px;
    border-radius: 12px;
    border-left: 4px solid var(--primary-color); /* Colorful accent */
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.help-text {
    font-size: 14px;
    color: #666;
    font-weight: 500;
    margin-left: auto;
    background: rgba(52, 152, 219, 0.1);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid rgba(52, 152, 219, 0.2);
}

/* Game Area Resizer */
.game-area-resizer {
    width: 8px;
    background: transparent;
    cursor: col-resize;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    z-index: 10;
}

.game-area-resizer-handle {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(90deg, transparent 0%, rgba(0,0,0,0.1) 50%, transparent 100%);
    transition: background 0.2s ease;
}

.game-area-resizer:hover .game-area-resizer-handle {
    background: linear-gradient(90deg, transparent 0%, rgba(52, 152, 219, 0.3) 50%, transparent 100%);
}

.resizer-grip {
    width: 2px;
    height: 40px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 1px;
    transition: all 0.2s ease;
}

.game-area-resizer:hover .resizer-grip {
    background: var(--primary-color);
    height: 60px;
    width: 3px;
}

.game-area-resizer.dragging .resizer-grip {
    background: var(--accent-color);
    height: 80px;
    width: 4px;
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.5);
}

/* Educational Hints for Kids */
.educational-hint {
    display: none;
}

.hint-icon {
    font-size: 24px;
    animation: bounce 2s infinite;
}

.hint-text {
    color: var(--dark-color);
    font-weight: 600;
    font-size: 15px;
}

@keyframes gentlePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-4px); }
    60% { transform: translateY(-2px); }
}

/* Font Awesome Icons Styling */
.icon-section {
    color: var(--primary-color);
    margin-right: 12px;
    font-size: 24px;
    flex-shrink: 0;
}

/* Button icons */
.btn-icon i {
    margin-right: 12px;
    font-size: 24px;
    color: inherit;
}

/* Hint icon */
.hint-icon i {
    font-size: 32px;
    color: var(--secondary-color);
    animation: bounce 2s infinite;
}



/* AMEC Footer */
.amec-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    padding: 5px 15px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 20px;
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.amec-logo {
    height: 24px;
    width: auto;
    object-fit: contain;
}

.amec-text {
    font-size: 11px;
    color: var(--dark-color);
    margin: 0;
    opacity: 0.7;
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 5px;
}

.amec-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    font-size: 11px;
}

.amec-link:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

.version-text {
    font-size: 10px;
    opacity: 0.6;
    font-weight: 400;
    color: var(--dark-color);
}

.version-hash {
    font-family: monospace;
    font-weight: 500;
    font-size: 10px;
}

.version-date {
    font-size: 9px;
    opacity: 0.5;
}

.game-grid {
    flex: 1;
    overflow-y: auto;
    /* Preserve character grid properties */
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)) !important;
    column-gap: clamp(10px, 1.5vw, 20px) !important;
    row-gap: clamp(15px, 3vh, 35px) !important; /* Increased dynamic row spacing */
    padding: 15px !important;
    padding-bottom: clamp(20px, 2.5vh, 30px) !important; /* More generous bottom padding */
    box-sizing: border-box !important;
    align-content: start !important; /* Align rows to the top */
}

/* Question Panel */
.question-panel {
    background: white;
    border-radius: var(--border-radius);
    padding: 15px;
    box-shadow: 0 4px 20px var(--shadow-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Resizable Panel Layout */
.resizable-panels {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: calc(100% - clamp(120px, 15vh, 160px)); /* Account for active points and progress */
    position: relative;
    min-height: 300px;
}

.questions-section {
    flex: 1;
    min-height: 200px;
    overflow-y: auto;
    padding-bottom: 10px;
}

.panel-resizer {
    height: 12px;
    background: transparent;
    cursor: ns-resize;
    position: relative;
    user-select: none;
}

.resizer-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 4px;
    background: var(--light-color);
    border-radius: 2px;
    transition: background 0.2s;
}

.panel-resizer:hover .resizer-handle,
.panel-resizer.dragging .resizer-handle {
    background: var(--primary-color);
    height: 5px;
}


@keyframes progressShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

#questionPanelContainer {
    overflow-y: auto;
    flex: 1;
    padding-right: 5px; /* Space for scrollbar */
}

.question-category {
    margin-bottom: 20px;
    overflow: visible;
}

.question-category-title {
    color: var(--primary-color);
    font-size: 18px;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.questions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.question-btn {
    padding: 16px 20px; /* Larger padding for kids */
    background: linear-gradient(135deg, var(--light-color), #ffffff);
    border: 3px solid transparent; /* Thicker border for visibility */
    border-radius: 15px; /* More rounded for friendlier look */
    font-size: 16px; /* Larger font for readability */
    font-weight: 600;
    color: var(--dark-color);
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px; /* Consistent minimum height */
    box-shadow: 0 2px 8px rgba(0,0,0,0.1); /* Subtle shadow for depth */
    position: relative;
}

/* Character count badge for questions */
.character-count-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(135deg, #5dade2, #3498db);
    color: #ffffff !important;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: bold;
    min-width: 24px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.4);
    transition: all 0.3s ease;
    z-index: 10;
}

.question-btn:hover .character-count-badge {
    background: linear-gradient(135deg, #3498db, #2471a3);
    transform: scale(1.15);
    box-shadow: 0 3px 12px rgba(52, 152, 219, 0.6);
}

.question-btn:hover {
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    border-color: var(--primary-color);
    transform: translateY(-3px) scale(1.02); /* More pronounced hover effect */
    box-shadow: 0 6px 16px rgba(52, 152, 219, 0.3); /* Blue shadow on hover */
    color: var(--primary-color); /* Text changes to blue on hover */
}

/* Guess Button */
.guess-character-btn {
    width: 100%;
    padding: 18px;
    margin-top: 20px;
    background: linear-gradient(135deg, var(--accent-color), #c0392b);
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.guess-character-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(231, 76, 60, 0.4);
}

.guess-character-btn::before {
    content: "🔍";
    font-size: 24px;
}

/* Guess Button Container - Always visible at bottom */
.guess-button-container {
    display: none;
}

/* Update the guess button when in container */
.guess-button-container .guess-character-btn {
    margin-top: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 16px;
    padding: 15px;
}

.guess-button-container .guess-character-btn::before {
    content: none; /* Remove the pseudo-element */
}

.guess-button-container .guess-character-btn i {
    font-size: 18px;
}

/* Guess Grid */
.guess-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin: 20px 0;
    max-height: 300px;
    overflow-y: auto;
}

.guess-character {
    padding: 8px;
    background: var(--light-color);
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 12px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Avatar image in guess character */
.guess-character-avatar {
    width: 0;
    height: 0;
    border-radius: 50%;
    object-fit: cover;
    transition: width 0.3s ease, height 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}

.guess-character:hover .guess-character-avatar {
    width: 30px;
    height: 30px;
    opacity: 1;
}

.guess-character-name {
    flex: 0 1 auto;
    transition: var(--transition);
    color: var(--dark-color) !important;
    font-weight: 600;
    text-align: center;
}

/* Tooltip for character names on hover */
.guess-character::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--dark-color);
    color: white;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    margin-bottom: 5px;
    z-index: 1000;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.guess-character:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-3px);
}

/* Ensure all interactive elements have pointer cursor */
button,
.character-card:not(.eliminated),
.question-btn,
.question-btn-main,
.tab-btn,
.lang-btn,
.difficulty-btn,
.guess-character,
.menu-btn,
.control-btn,
.win-btn,
.back-btn,
.confirm-btn,
.close-modal,
.guess-confirm-btn,
.modal-btn,
.modal-ok,
.modal-yes,
.modal-no,
.carousel-btn,
.shortcut-btn {
    cursor: pointer !important;
}

/* Disabled or eliminated items should not have pointer cursor */
.character-card.eliminated,
button:disabled,
.question-btn:disabled {
    cursor: not-allowed !important;
    opacity: 0.6;
    background: linear-gradient(135deg, #95a5a6, #7f8c8d) !important; /* Grey gradient */
    color: #ffffff !important;
    position: relative;
    transform: none !important;
}

.question-btn:disabled .character-count-badge {
    display: none;
}

.question-btn:disabled::after {
    content: "✓ ASKED";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 700;
    color: white;
    background: rgba(46, 204, 113, 0.9); /* Green background */
    padding: 2px 8px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.question-btn:disabled:hover {
    transform: none !important;
    background: linear-gradient(135deg, #95a5a6, #7f8c8d) !important;
    border-color: transparent !important;
}

/* Additional styling for question-used class for higher specificity */
.question-btn.question-used {
    cursor: not-allowed !important;
    opacity: 0.6 !important;
    background: linear-gradient(135deg, #95a5a6, #7f8c8d) !important;
    color: #ffffff !important;
    pointer-events: none !important;
    transform: none !important;
}

/* Styling for pointless questions (0 matching characters) */
.question-btn.question-pointless {
    cursor: not-allowed !important;
    opacity: 0.4 !important;
    background: linear-gradient(135deg, #ecf0f1, #bdc3c7) !important;
    color: #7f8c8d !important;
    pointer-events: none !important;
    transform: none !important;
    border: 2px solid #95a5a6 !important;
}

.question-btn.question-pointless .character-count-badge {
    background: #e74c3c !important;
    color: white !important;
    font-weight: bold !important;
}

.question-btn.question-used::after {
    content: "✓ ASKED";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 700;
    color: white;
    background: rgba(46, 204, 113, 0.9);
    padding: 2px 8px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    z-index: 10;
    box-shadow: none !important;
}

.guess-character:hover {
    border-color: var(--secondary-color);
    transform: scale(1.1);
}

.guess-character.selected {
    border-color: var(--accent-color);
    background: linear-gradient(135deg, var(--secondary-color), #f39c12); /* Sunflower to Orange */
    color: var(--dark-color);
    font-weight: 700;
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(241, 196, 15, 0.4);
}

.guess-character.selected .guess-character-avatar {
    width: 30px;
    height: 30px;
    opacity: 1;
}

.guess-character.selected .guess-character-name::before {
    content: "✓ ";
    font-weight: bold;
    color: var(--accent-color);
}

/* Chat History */
.chat-history {
    flex-shrink: 0;
    min-height: 100px;
    max-height: 40%;
    display: flex;
    flex-direction: column;
    padding-top: 10px;
}

.chat-history h4 {
    color: var(--dark-color);
    margin-bottom: 8px;
    font-size: 14px;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    background: var(--light-color);
    border-radius: 10px;
    font-size: 13px;
}

.history-item {
    padding: 6px 8px;
    margin-bottom: 6px;
    background: white;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.3;
}

.history-item.team1 {
    background: linear-gradient(135deg, #3498db20, #2ecc7120); /* Blue to Green */
    border-left: 3px solid var(--primary-color);
}

.history-item.team2 {
    background: linear-gradient(135deg, #e74c3c20, #f1c40f20); /* Red to Yellow */
    border-left: 3px solid var(--accent-color);
}


/* Win Screen */
.win-container {
    background: white;
    padding: 50px;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px var(--shadow-color);
    text-align: center;
    max-width: 500px;
    margin: 0 auto;
}

.trophy {
    font-size: 100px;
    margin-bottom: 20px;
    animation: bounce 1s ease-in-out infinite;
}

.win-title {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.final-score {
    font-size: 32px;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 20px;
}

.final-score span:last-child {
    color: var(--accent-color);
}

.win-details {
    font-size: 18px;
    color: var(--dark-color);
    margin-bottom: 30px;
    line-height: 1.6;
}

.win-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.win-btn {
    padding: 15px 30px;
    font-size: 16px;
}

/* Responsive Design */
/* Desktop flat design - CSS Grid/Flexbox approach with no body scroll */
@media (min-width: 1024px) {
    /* Eliminate body scroll completely */
    html, body {
        height: 100vh;
        overflow: hidden;
        margin: 0;
        padding: 0;
    }
    
    /* Full viewport screens using CSS Grid */
    .game-container, .character-selector, .team-setup, .main-menu, #teacherScreen {
        display: grid;
        height: 100vh;
        width: 100vw;
        overflow: hidden;
        position: fixed;
        top: 0;
        left: 0;
    }
    
    /* Menu: full-width layout from left to right edge */
    .main-menu {
        display: grid;
        grid-template-rows: auto 1fr auto; /* Title, Menu, Footer */
        align-content: center;
        padding: 0;
        width: 100vw;
        height: 100vh;
    }
    
    .menu-container {
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        padding: 0 !important;
        margin: 0 auto !important;
    }
    
    .menu-grid-2x2 {
        width: min(90%, 70vh) !important;
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        grid-template-rows: repeat(2, 1fr) !important;
        gap: clamp(16px, 2vw, 30px) !important;
        place-items: stretch !important;
        margin: 0 auto !important;
    }
    
    /* Game area: adaptive layout - full width for single panels */
    .game-area {
        display: grid;
        /* Dynamic columns: character section, resizer, sidebar */
        grid-template-columns: 2fr auto 1fr;
        height: 100vh;
        width: 100vw;
        overflow: hidden;
        gap: 0;
        margin: 0;
        padding: 0;
    }
    
    /* When sidebar is hidden, character section takes full width */
    .game-area:has(.sidebar.hidden) .character-section,
    .game-area .character-section:only-child {
        grid-column: 1 / -1; /* Span full width */
    }
    
    /* Character section: maximize space utilization */
    .character-section {
        display: grid;
        grid-template-rows: auto 1fr; /* Title + Grid */
        overflow: hidden;
        padding: 1vh 1vw; /* Minimal padding for maximum content space */
        width: 100%;
        height: 100vh;
    }
    
    /* Character grid: maximize visible items without scroll */
    .character-grid, .game-grid {
        display: grid;
        /* Dynamic grid: calculate optimal columns/rows based on screen ratio */
        /* Similar logic to teacher grid - prefer more rows on tall screens */
        grid-template-columns: repeat(auto-fit, minmax(clamp(100px, 14vw, 180px), 1fr));
        /* Let grid auto-flow to use available height efficiently */
        column-gap: clamp(10px, 1.5vw, 20px);
        row-gap: clamp(10px, 1.5vh, 25px); /* Dynamic vertical spacing based on viewport */
        overflow-y: auto; /* Allow scrolling if needed */
        overflow-x: hidden;
        align-content: space-evenly; /* Distribute rows evenly in available space */
        justify-content: stretch;
        height: 100%; /* Use full available height */
        padding: clamp(10px, 1vw, 15px); /* Better padding */
        padding-bottom: clamp(15px, 1.5vh, 25px); /* Dynamic bottom padding */
        box-sizing: border-box;
        
        /* Let rows be flexible in height to fill space */
        grid-auto-rows: 1fr; /* Equal height rows that fill available space */
    }
    
    /* Character cards: optimized layout for full image visibility */
    .character-card {
        display: flex;
        flex-direction: column;
        /* Better aspect ratio for character details */
        aspect-ratio: 4/5;
        overflow: visible;
        /* Fill grid cell while maintaining aspect ratio */
        width: 100%;
        height: auto;
        padding: clamp(6px, 1vw, 12px);
        border-radius: clamp(10px, 1.5vw, 16px);
        background: white;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
    
    .character-card img {
        flex: 1;
        object-fit: contain;
        width: 100%;
        height: 100%;
        background: white;
    }
    
    /* Sidebar: maximize vertical space utilization */
    .sidebar {
        display: flex;
        flex-direction: column;
        overflow: hidden;
        padding: 0.5vh 0.3vw; /* Minimal padding for maximum content */
        gap: 0.5vh; /* Smaller gaps */
        width: 25vw;
        height: 100vh;
    }
    
    /* Question/History panels: adaptive sizing */
    .resizable-panels {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        gap: 0.3vh; /* Small gap between panels */
    }
    
    .questions-section, .chat-history {
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        min-height: 0; /* Important for flex scroll */
        padding: 0.3vh; /* Minimal internal padding */
    }
    
    /* When one panel is hidden, the other gets full height */
    .questions-section:only-child,
    .chat-history:only-child {
        flex: 1;
        height: 100%;
    }
    
    /* Guess button: fixed at bottom */
    .guess-button-container {
        flex-shrink: 0;
        padding: 1vh 0;
    }
    
    /* Selector screens: maximize content space */
    .character-selector, .team-setup {
        display: grid;
        grid-template-rows: auto 1fr auto;
        padding: 2vh 2vw; /* Reduced padding for more content space */
        width: 100vw;
        height: 100vh;
        overflow: hidden;
    }
    
    /* Teacher screen: minimize padding for maximum grid space */
    #teacherScreen {
        display: grid;
        grid-template-rows: auto 1fr auto;
        padding: 0.5vh 1vw; /* Minimal padding for maximum content space */
        width: 100vw;
        height: 100vh;
        overflow: hidden;
    }
    
    /* Teacher screen container: optimize space usage */
    .teacher-container {
        display: grid;
        grid-template-rows: auto 1fr auto; /* Only 3 rows now - header+selector, grid, button */
        height: 100%;
        gap: 0.2vh; /* Minimal gaps */
        padding: 0.2vh 0.2vw; /* Minimal padding for maximum grid space */
    }
    
    /* Inline title styling for merged header */
    .character-count-selector {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 2vw;
        flex-wrap: wrap;
    }
    
    .character-count-left {
        display: flex;
        align-items: center;
        gap: 1vw;
        flex: 1;
    }
    
    .inline-title {
        margin: 0;
        font-size: clamp(20px, 3vw, 32px);
    }
    
    /* Teacher grid: optimize for height-based layout with larger images */
    .teacher-grid {
        display: grid;
        /* Dynamic grid: calculate optimal columns/rows based on screen ratio */
        /* For 30 items: prefer more rows on tall screens, fewer on wide screens */
        grid-template-columns: repeat(auto-fit, minmax(clamp(120px, 15vw, 200px), 1fr));
        /* Let grid auto-flow to use available height efficiently */
        gap: 0.5vw;
        overflow: hidden;
        align-content: stretch;
        justify-content: stretch;
        height: 100%;
        padding: 0.2vh;
        
        /* Ensure we use available height for larger cards */
        grid-auto-rows: minmax(clamp(120px, 15vh, 200px), auto);
    }
    
    .selector-grid {
        display: grid;
        /* Optimize to fit all items without scrolling */
        grid-template-columns: repeat(auto-fit, minmax(clamp(100px, 12vw, 180px), 1fr));
        grid-template-rows: repeat(auto-fit, minmax(clamp(100px, 12vw, 180px), 1fr));
        gap: 0.3vw; /* Smaller gaps for more content */
        overflow: hidden; /* No scrolling - fit everything */
        align-content: stretch;
        justify-content: stretch;
        height: 100%;
        padding: 0.2vh;
    }
    
    .selector-card {
        display: flex;
        flex-direction: column;
        /* Better aspect ratio for character details */
        aspect-ratio: 4/5;
        overflow: hidden;
        width: 100%;
        height: 100%;
    }
    
    /* Modal: larger sizing for desktop */
    .modal-dialog {
        max-width: 70vw;
        min-width: 60vw;
        max-height: 80vh;
        min-height: 50vh;
        overflow-y: auto;
        padding: 50px;
    }
    
    /* Single row layout adjustments for tablets */
    .menu-grid-single-row {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
        width: 90%;
    }
    
    /* Modal icons and text scaling for desktop */
    .modal-icon {
        font-size: 80px;
    }
    
    .modal-title {
        font-size: clamp(24px, 3vw, 36px);
        margin-bottom: 20px;
    }
    
    .modal-message {
        font-size: clamp(16px, 2vw, 20px);
        line-height: 1.5;
    }
    
    .modal-btn {
        font-size: clamp(16px, 2vw, 20px);
        padding: clamp(12px, 1.5vh, 18px) clamp(24px, 3vw, 36px);
        min-height: clamp(48px, 6vh, 60px);
    }
    
    /* Responsive scaling */
    .menu-btn, .nav-btn, .question-btn, .guess-character-btn {
        font-size: clamp(16px, 2vw, 24px);
        padding: clamp(12px, 2vh, 20px) clamp(16px, 3vw, 30px);
        min-height: clamp(40px, 6vh, 60px);
    }
    
    .btn-icon-large {
        font-size: 2.5rem;
        padding: 8px;
    }

    .btn-text {
        font-size: 14px;
        font-weight: 600;
    }
    
    .title-text {
        font-size: clamp(32px, 8vw, 80px);
    }
    
    .title-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .title-avatar {
        width: 60px;
        height: 60px;
        border-width: 3px;
    }
    
    /* Character editor responsive - compact sticky header */
    .character-detail-header-sticky {
        padding: 10px;
        gap: 10px;
    }
    
    .character-image-preview-compact {
        flex: 0 0 80px;
    }
    
    .character-preview-img-compact {
        width: 80px;
        height: 80px;
        border-width: 2px;
    }
    
    .compact-info-row {
        flex-direction: column;
        gap: 5px;
    }
    
    .compact-field label,
    .compact-field-full label {
        font-size: 12px;
    }
    
    .compact-field strong {
        font-size: 13px;
    }
}

/* Large desktop - optimized square grid density */
@media (min-width: 1440px) {
    .menu-grid-2x2 {
        width: min(90%, 75vh) !important;
        gap: clamp(18px, 2vw, 32px) !important;
    }

    .btn-icon-large {
        font-size: 3rem;
        padding: 10px;
    }

    .btn-text {
        font-size: 18px;
    }
    
    .game-area {
        grid-template-columns: 2fr auto 1fr;
    }
    
    .character-grid, .game-grid {
        grid-template-columns: repeat(auto-fit, minmax(clamp(110px, 12vw, 160px), 1fr));
        grid-auto-rows: minmax(clamp(138px, 15vh, 200px), auto);
        gap: 0.2vw; /* Tighter spacing for more items */
        align-content: stretch;
        justify-content: stretch;
    }
    
    .selector-grid {
        grid-template-columns: repeat(auto-fit, minmax(clamp(90px, 11vw, 160px), 1fr));
        grid-template-rows: repeat(auto-fit, minmax(clamp(90px, 11vw, 160px), 1fr));
        gap: 0.2vw;
    }
    
    /* Teacher grid: larger images on big screens */
    .teacher-grid {
        grid-template-columns: repeat(auto-fit, minmax(clamp(140px, 12vw, 180px), 1fr));
        grid-auto-rows: minmax(clamp(140px, 12vh, 180px), auto);
        gap: 0.3vw;
    }
}

/* Ultra-wide screens - maximize square columns */
@media (min-width: 1600px) {
    .menu-grid-2x2 {
        width: min(90%, 80vh) !important;
        gap: clamp(20px, 2vw, 36px) !important;
    }

    .btn-icon-large {
        font-size: 3.5rem;
        padding: 12px;
    }

    .btn-text {
        font-size: 20px;
    }
    
    .game-area {
        grid-template-columns: 2fr auto 1fr;
    }
    
    .character-grid, .game-grid {
        grid-template-columns: repeat(auto-fit, minmax(clamp(120px, 10vw, 150px), 1fr));
        grid-auto-rows: minmax(clamp(150px, 12.5vh, 188px), auto);
        gap: 0.15vw;
        align-content: stretch;
        justify-content: stretch;
    }
    
    .selector-grid {
        grid-template-columns: repeat(auto-fit, minmax(clamp(80px, 9vw, 140px), 1fr));
        grid-template-rows: repeat(auto-fit, minmax(clamp(80px, 9vw, 140px), 1fr));
        gap: 0.15vw;
    }
    
    /* Teacher grid: even larger on ultra-wide screens */
    .teacher-grid {
        grid-template-columns: repeat(auto-fit, minmax(clamp(160px, 10vw, 200px), 1fr));
        grid-auto-rows: minmax(clamp(160px, 10vh, 200px), auto);
        gap: 0.2vw;
    }
    
    /* Larger modals for ultra-wide displays */
    .modal-dialog {
        max-width: 65vw;
        min-width: 55vw;
        max-height: 75vh;
        min-height: 45vh;
        padding: 55px;
    }
    
    .modal-icon {
        font-size: 100px;
    }
    
    .modal-title {
        font-size: clamp(28px, 3.5vw, 42px);
        margin-bottom: 25px;
    }
    
    .modal-message {
        font-size: clamp(18px, 2.2vw, 24px);
        line-height: 1.5;
    }
    
    .modal-btn {
        font-size: clamp(17px, 2.2vw, 22px);
        padding: clamp(14px, 1.8vh, 20px) clamp(28px, 3.5vw, 42px);
        min-height: clamp(52px, 7vh, 66px);
    }
}

/* Extra large displays and TVs - maximum square density */
@media (min-width: 2000px) {
    .menu-grid-2x2 {
        width: min(90%, 85vh) !important;
        gap: clamp(24px, 2vw, 40px) !important;
    }

    .btn-icon-large {
        font-size: 4rem;
        padding: 15px;
    }

    .btn-text {
        font-size: 24px;
    }
    
    .game-area {
        grid-template-columns: 2fr auto 1fr;
    }
    
    .character-grid, .game-grid {
        grid-template-columns: repeat(auto-fit, minmax(clamp(130px, 8vw, 160px), 1fr));
        grid-auto-rows: minmax(clamp(163px, 10vh, 200px), auto);
        gap: 0.1vw;
        align-content: stretch;
        justify-content: stretch;
    }
    
    .selector-grid {
        grid-template-columns: repeat(auto-fit, minmax(clamp(70px, 7vw, 120px), 1fr));
        grid-template-rows: repeat(auto-fit, minmax(clamp(70px, 7vw, 120px), 1fr));
        gap: 0.1vw;
    }
    
    /* Teacher grid: maximum size on TVs with optimal aspect ratio */
    .teacher-grid {
        grid-template-columns: repeat(auto-fit, minmax(clamp(180px, 8vw, 220px), 1fr));
        grid-auto-rows: minmax(clamp(180px, 8vh, 220px), auto);
        gap: 0.15vw;
    }
    
    /* Larger modals for TV/large displays */
    .modal-dialog {
        max-width: 60vw;
        min-width: 50vw;
        max-height: 70vh;
        min-height: 40vh;
        padding: 60px;
    }
    
    .modal-icon {
        font-size: 120px;
    }
    
    .modal-title {
        font-size: clamp(32px, 4vw, 48px);
        margin-bottom: 30px;
    }
    
    .modal-message {
        font-size: clamp(20px, 2.5vw, 28px);
        line-height: 1.6;
    }
    
    .modal-btn {
        font-size: clamp(18px, 2.5vw, 24px);
        padding: clamp(16px, 2vh, 24px) clamp(32px, 4vw, 48px);
        min-height: clamp(56px, 8vh, 72px);
    }
}

/* Tall screens - optimize for more rows with larger images */
@media (min-aspect-ratio: 4/3) and (min-width: 1024px) {
    .teacher-grid {
        /* For tall/square screens: prefer more rows, larger images */
        grid-template-columns: repeat(auto-fit, minmax(clamp(150px, 18vw, 250px), 1fr)) !important;
        grid-auto-rows: minmax(clamp(150px, 15vh, 250px), auto) !important;
        gap: 0.5vw !important;
        align-content: stretch !important;
        justify-content: stretch !important;
    }
    
    .character-grid, .game-grid {
        /* For tall/square screens: prefer more rows with larger character cards */
        grid-template-columns: repeat(auto-fit, minmax(clamp(100px, 15vw, 180px), 1fr)) !important;
        grid-auto-rows: minmax(clamp(125px, 15vh, 225px), auto) !important;
        gap: 0.4vw !important;
    }
}

/* Very wide screens - use moderate size to prevent too few rows */
@media (min-aspect-ratio: 21/9) and (min-width: 1600px) {
    .teacher-grid {
        /* For ultra-wide screens: balance between size and row count */
        grid-template-columns: repeat(auto-fit, minmax(clamp(140px, 12vw, 180px), 1fr)) !important;
        grid-auto-rows: minmax(clamp(140px, 12vh, 180px), auto) !important;
        gap: 0.3vw !important;
        align-content: stretch !important;
        justify-content: stretch !important;
    }
    
    .character-grid, .game-grid {
        /* For ultra-wide screens: balance between size and row count */
        grid-template-columns: repeat(auto-fit, minmax(clamp(130px, 12vw, 170px), 1fr)) !important;
        grid-auto-rows: minmax(clamp(130px, 12vh, 170px), auto) !important;
        gap: 0.2vw !important;
    }
}

/* Standard widescreen 16:9 - optimize for common desktop displays */
@media (min-aspect-ratio: 16/9) and (max-aspect-ratio: 18/9) and (min-width: 1024px) {
    .character-grid, .game-grid {
        /* For 16:9 screens: larger cards to fill horizontal space better */
        grid-template-columns: repeat(auto-fit, minmax(clamp(120px, 13vw, 180px), 1fr)) !important;
        grid-auto-rows: minmax(clamp(120px, 13vh, 180px), auto) !important;
        gap: 0.25vw !important;
    }
    
    .teacher-grid {
        /* Larger teacher grid cards on 16:9 displays */
        grid-template-columns: repeat(auto-fit, minmax(clamp(160px, 14vw, 200px), 1fr)) !important;
        grid-auto-rows: minmax(clamp(160px, 14vh, 200px), auto) !important;
        gap: 0.4vw !important;
        align-content: stretch !important;
        justify-content: stretch !important;
    }
}

/* Tablet landscape - CSS Grid with vertical stack */
@media (min-width: 768px) and (max-width: 1023px) {
    html, body {
        height: 100vh;
        overflow: hidden;
    }
    
    .game-container, .main-menu, .character-selector, .team-setup {
        display: grid;
        height: 100vh;
        overflow: hidden;
    }
    
    /* Tablet menu: 2x2 grid for better fit */
    .main-menu {
        place-content: center;
    }
    
    .menu-grid-2x2 {
        width: min(90vw, 60vh);
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr 1fr;
        gap: clamp(15px, 3vw, 30px);
        place-items: stretch;
    }
    
    /* Tablet game area: vertical stack layout */
    .game-area {
        display: grid;
        grid-template-rows: 60vh 40vh;
        height: 100vh;
        overflow: hidden;
    }
    
    .character-section {
        display: grid;
        grid-template-rows: auto 1fr;
        overflow: hidden;
        padding: 2vh 2vw;
    }
    
    .character-grid, .game-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(clamp(100px, 18vw, 150px), 1fr));
        gap: 2vw;
        overflow-y: auto;
        overflow-x: hidden;
        align-content: start;
    }
    
    .character-card {
        display: flex;
        flex-direction: column;
        aspect-ratio: 4/5;
        overflow: hidden;
    }
    
    .character-card img {
        flex: 1;
        object-fit: contain;
        background: white;
    }
    
    .sidebar {
        display: flex;
        flex-direction: column;
        overflow: hidden;
        padding: 2vh 4vw;
        gap: 2vh;
    }
    
    .resizable-panels {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    
    .questions-section, .chat-history {
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        min-height: 0;
    }
    
    .guess-button-container {
        flex-shrink: 0;
        padding: 1vh 0;
    }
}

/* Tablet portrait and small screens - allow vertical scrolling */
@media (max-width: 767px) {
    /* Re-enable body scroll for mobile */
    html, body {
        overflow-y: auto !important;
        height: auto !important;
    }
    
    /* Mobile screens can scroll vertically */
    .game-container, .character-selector, .team-setup, #teacherScreen, .main-menu {
        position: relative !important;
        height: auto !important;
        min-height: 100vh;
        overflow-y: auto !important;
    }
    
    /* Character grids can scroll on mobile */
    .character-grid, .game-grid, .teacher-grid, .selector-grid {
        overflow-y: auto !important;
        max-height: 70vh; /* Limit height to allow scrolling */
    }
    .title-text {
        font-size: clamp(32px, 6vw, 48px);
    }
    
    /* Menu grid responsive - 3 buttons layout */
    .menu-grid-2x2 {
        display: grid;
        grid-template-columns: repeat(2, 160px);
        grid-template-rows: 160px 160px;
        gap: 15px;
        max-width: 350px;
        justify-content: center;
    }
    
    /* Adjust menu grid for tablets in landscape */
    .menu-grid-single-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        width: 85%;
    }
    
    /* Hide character editor on mobile - not practical for editing */
    #openCharacterEditor {
        display: none !important;
    }
    
    .menu-btn-square {
        width: 100%;
        max-width: 180px;
        aspect-ratio: 1 / 1;
        padding: 18px;
        gap: 10px;
        justify-self: center;
    }
    
    .btn-icon-large {
        font-size: 2.2rem;
        margin-bottom: 5px;
        padding: 6px;
    }
    
    .btn-text {
        font-size: 14px;
    }
    
    .game-area {
        grid-template-columns: 1fr;
        height: auto;
        gap: 10px;
        max-height: calc(100vh - 80px);
    }
    
    .character-grid, .game-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(75px, calc((100% - 70px) / 4)), 1fr)) !important;
        gap: 10px !important;
        padding: 10px !important;
        max-height: 65vh;
        overflow: visible;
    }
    
    /* Character name ribbons now use clamp() for responsive sizing */
    
    .game-header {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
    }
    
    .menu-btn {
        font-size: 16px;
        padding: 12px 15px;
    }
    
    
    .characters-section {
        padding: 15px;
        max-height: 70vh;
    }
    
    /* Character count selector responsive */
    .character-count-selector {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 12px;
        margin: 10px 0;
    }
    
    .character-count-left {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .count-label {
        font-size: 14px;
        text-align: center;
    }
    
    .count-select {
        padding: 10px 15px;
        font-size: 14px;
        width: 100%;
    }
    
    .inline-random-btn {
        margin: 10px 0 0 0;
        width: 100%;
        font-size: 14px;
        padding: 10px 15px;
    }
    
    /* Character preview modal responsive */
    #characterPreviewModal .modal-content,
    .character-preview-dialog {
        max-width: 100%;
        width: 95%;
        margin: 10px;
    }
    
    .character-preview-content {
        flex-direction: column;
        align-items: center;
    }
    
    .character-preview-image img {
        width: 120px;
        height: 120px;
    }
    
    .character-attributes {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    /* Menu grid for small phones - 3 buttons layout */
    .menu-grid-2x2 {
        display: grid;
        grid-template-columns: repeat(2, 130px);
        grid-template-rows: 130px 130px;
        gap: 12px;
        max-width: 280px;
        justify-content: center;
    }
    
    /* Adjust menu grid for tablets in landscape */
    .menu-grid-single-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        width: 85%;
    }
    
    .menu-btn-square {
        width: 100%;
        max-width: 160px;
        aspect-ratio: 1 / 1;
        padding: 15px;
        gap: 8px;
        justify-self: center;
    }
    
    /* Hide character editor on mobile - not practical for editing */
    #openCharacterEditor {
        display: none !important;
    }
    
    .btn-icon-large {
        font-size: 1.8rem;
        margin-bottom: 3px;
        padding: 5px;
    }
    
    .btn-text {
        font-size: 12px;
    }
    
    /* Mobile-specific game improvements */
    .game-container {
        padding: 5px;
        padding-bottom: 10px !important; /* Minimal footer space on mobile */
    }
    
    .questions-panel {
        padding: 10px;
    }
    
    .question-category-title {
        font-size: 14px;
        padding: 8px 12px;
    }
    
    /* Extra small guess button for very small screens */
    .guess-button-container {
        padding: 6px 12px !important;
        border-radius: 20px !important;
    }
    
    .guess-button-container .menu-btn {
        font-size: 11px !important;
        padding: 4px 8px !important;
    }
    
    .guess-button-container .guess-character-btn {
        font-size: 11px !important;
        padding: 6px 10px !important;
        gap: 4px !important;
    }
    
    .guess-button-container .guess-character-btn i {
        font-size: 12px !important;
    }
    
    /* Hide game area resizer on extra small screens */
    .game-area-resizer {
        display: none !important;
    }
    
    .game-area {
        grid-template-columns: 1fr !important;
        grid-template-rows: 1fr 1fr !important;
    }
    
    .question-btn {
        font-size: 13px;
        padding: 8px 12px;
        min-height: 44px;
    }
    
    /* Make character tooltips work better on mobile */
    .character-tooltip {
        position: fixed !important;
        top: 10px !important;
        left: 10px !important;
        right: 10px !important;
        transform: none !important;
        max-width: none !important;
        z-index: 9999;
    }
    
    /* Fix game layout for mobile - prevent overlapping */
    .game-container {
        flex-direction: column !important;
        height: auto !important;
        min-height: 100vh;
        overflow-x: hidden;
    }
    
    .game-area {
        grid-template-columns: 1fr !important;
        grid-template-rows: auto auto !important;
        height: calc(100vh - 20px) !important; /* Use full viewport height minus small margin */
        gap: 8px;
        padding: 5px !important;
        margin: 0 !important;
        overflow: hidden !important;
    }
    
    .characters-section {
        order: 2; /* Move characters to bottom */
        height: calc(50vh - 10px); /* Precise calculation for 50% minus gap */
        max-height: calc(50vh - 10px);
        overflow: hidden;
        padding: 8px;
        flex-shrink: 0;
        display: flex;
        flex-direction: column;
    }
    
    .characters-section .character-grid {
        overflow-y: auto !important;
        max-height: calc(100% - 40px); /* Fill available space in character section */
        flex-grow: 1;
    }
    
    .question-panel {
        order: 1; /* Move questions to top */
        height: calc(50vh - 10px); /* Precise calculation for 50% minus gap */
        max-height: calc(50vh - 10px);
        overflow: hidden;
        padding: 8px;
        flex-shrink: 0;
        display: flex;
        flex-direction: column;
    }
    
    .resizable-panels {
        height: calc(100% - 50px) !important; /* More space without progress section */
        overflow: hidden !important;
        flex-grow: 1;
    }
    
    .guess-button-container {
        position: fixed !important;
        bottom: 20px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        z-index: 1000 !important;
        margin: 0 !important;
        padding: 8px 15px !important;
        background: linear-gradient(135deg, #e74c3c, #c0392b) !important;
        border-radius: 25px !important;
        box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4) !important;
        backdrop-filter: blur(10px) !important;
    }
    
    .guess-button-container .menu-btn {
        margin: 0 !important;
        background: transparent !important;
        border: none !important;
        color: white !important;
        font-weight: 600 !important;
        font-size: 12px !important;
        padding: 6px 12px !important;
        box-shadow: none !important;
        min-height: auto !important;
    }
    
    /* Make guess button smaller on mobile */
    .guess-button-container .guess-character-btn {
        font-size: 12px !important;
        padding: 8px 12px !important;
        min-height: auto !important;
        gap: 6px !important;
    }
    
    .guess-button-container .guess-character-btn i {
        font-size: 14px !important;
    }
    
    /* Hide game area resizer on mobile - not practical for touch */
    .game-area-resizer {
        display: none !important;
    }
    
    /* Mobile layout uses vertical stacking instead of columns */
    .game-area {
        grid-template-columns: 1fr !important;
        grid-template-rows: 1fr 1fr !important;
    }
    
    .questions-section {
        overflow-y: auto !important;
        height: 100% !important;
        padding: 8px !important;
    }
    
    .chat-history {
        overflow-y: auto !important;
        height: 100% !important;
        padding: 8px !important;
    }
    
    /* Ensure top elements don't take too much space */
    .active-points-display {
        flex-shrink: 0 !important;
        height: auto !important;
        padding: 8px !important;
    }
    
    
    /* Mobile footer improvements */
    .amec-footer {
        bottom: 2px !important; /* Reduce bottom space */
        left: 10px !important;
        right: 10px !important;
        transform: none !important;
        width: auto !important;
        flex-direction: row !important; /* Change back to row for single line */
        gap: 8px !important; /* Increase gap for horizontal spacing */
        padding: 3px 6px !important; /* Reduced padding from 6px 10px */
    }
    
    .amec-text {
        font-size: 8px !important; /* Reduced from 9px to 8px */
        text-align: center !important;
        line-height: 1.1 !important; /* Reduced from 1.2 to 1.1 */
        flex-direction: row !important; /* Change to row for inline */
        gap: 4px !important; /* Gap for horizontal spacing */
    }
    
    .amec-text span[data-en] {
        display: none !important; /* Hide long organization name on mobile */
    }
    
    .amec-text::before {
        content: "AMEC" !important; /* Show short version instead */
        font-weight: 600 !important;
        color: var(--primary-color) !important;
    }
    
    .amec-logo {
        height: 20px !important;
    }
    
    .version-text {
        font-size: 8px !important;
        opacity: 0.6 !important;
    }
    
    /* Fix modal positioning on mobile */
    .modal-dialog {
        margin: 10px !important;
        max-height: calc(100vh - 20px);
        overflow-y: auto;
    }
    
    /* Mobile-specific touch optimizations */
    .question-btn {
        min-height: 48px; /* Better touch target */
        margin: 2px 0; /* More spacing for touch */
    }
    
    .character-card {
        min-height: 80px; /* Larger touch target for characters */
        cursor: pointer;
    }
    
    .nav-icon-btn, .inline-control-btn {
        min-width: 48px; /* iOS/Android recommended minimum */
        min-height: 48px;
    }
    
    /* Hide mouse hover effects on touch devices */
    @media (hover: none) and (pointer: coarse) {
        .character-card:hover,
        .question-btn:hover,
        .menu-btn-square:hover {
            transform: none !important;
        }
    }
    
    .character-grid, .game-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(65px, calc((100% - 60px) / 3)), 1fr)) !important;
        gap: 8px !important;
        padding: 8px !important;
        overflow: visible;
    }
    
    /* Character name ribbons now use clamp() for responsive sizing */
    
    /* Extra compact footer for very small screens */
    .amec-footer {
        padding: 2px 4px !important; /* Even smaller padding */
        gap: 6px !important; /* Horizontal spacing */
        bottom: 1px !important;
        flex-direction: row !important; /* Keep horizontal */
    }
    
    .amec-text {
        font-size: 7px !important; /* Even smaller text */
        line-height: 1.0 !important;
        gap: 3px !important; /* Small horizontal spacing */
        flex-direction: row !important; /* Keep horizontal */
    }
    
    .amec-logo {
        height: 16px !important; /* Smaller logo */
    }
    
    .game-area {
        height: calc(100vh - 60px);
    }
}

/* Editor-specific overrides */
.editor-mode .language-toggle {
    display: none !important;
}

/* Character Editor Styles */
.editor-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px var(--shadow-color);
    height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
}

/* Editor Tabs */
.editor-tabs {
    display: flex;
    border-bottom: 2px solid var(--light-color);
    margin-bottom: 20px;
}

.editor-tab {
    padding: 12px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.editor-tab:hover {
    color: var(--primary-color);
    background: rgba(52, 152, 219, 0.05);
}

.editor-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: rgba(52, 152, 219, 0.1);
}

.editor-tab i {
    font-size: 16px;
}

.editor-tab-content {
    display: none;
    flex: 1;
    overflow: hidden;
}

.editor-tab-content.active {
    display: flex;
    gap: 20px;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--light-color);
}

.editor-header h2 {
    color: var(--primary-color);
    font-size: 28px;
    margin: 0;
}

.editor-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.editor-btn {
    padding: 8px 16px;
    border: 2px solid var(--primary-color);
    background: white;
    color: var(--primary-color);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.editor-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.editor-btn i {
    font-size: 14px;
}

.editor-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

/* Questions Editor Styles */
.questions-categories {
    width: 300px;
    background: var(--light-color);
    border-radius: 12px;
    padding: 15px;
    overflow-y: auto;
    max-height: 100%;
}

.questions-detail {
    flex: 1;
    background: var(--light-color);
    border-radius: 12px;
    padding: 20px;
    overflow-y: auto;
}

.question-category-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 8px;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.question-category-item:hover {
    background: var(--primary-color);
    color: white;
    transform: translateX(5px);
}

.question-category-item.selected {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

.question-category-icon {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    background: var(--secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
    font-weight: bold;
}

.question-category-info {
    flex: 1;
}

.question-category-name {
    font-weight: 600;
    font-size: 14px;
}

.question-category-count {
    font-size: 12px;
    opacity: 0.7;
}

.question-form {
    display: none;
}

.question-form.active {
    display: block;
}

.question-item {
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.question-item h4 {
    margin: 0 0 10px 0;
    color: var(--dark-color);
    font-size: 14px;
}

.question-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.question-input {
    width: 100%;
    padding: 8px 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
}

.question-input:focus {
    border-color: var(--primary-color);
    outline: none;
}

.add-question-btn {
    background: var(--success-color);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.add-question-btn:hover {
    background: #27ae60;
}

.remove-question-btn {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    float: right;
}

.remove-question-btn:hover {
    background: #c0392b;
}

.character-list {
    width: 300px;
    background: var(--light-color);
    border-radius: 12px;
    padding: 15px;
    overflow-y: auto;
    max-height: 100%;
    display: flex;
    flex-direction: column;
}

.character-search {
    position: relative;
    margin-bottom: 15px;
}

.search-input {
    width: 100%;
    padding: 10px 35px 10px 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: var(--transition);
    background: white;
}

.search-input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    font-size: 14px;
}

.character-items {
    flex: 1;
    overflow-y: auto;
}

.character-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 8px;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.character-item:hover {
    background: var(--primary-color);
    color: white;
    transform: translateX(5px);
}

.character-item.selected {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

.character-item img {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
}

.character-item-info {
    flex: 1;
}

.character-item-name {
    font-weight: 600;
    font-size: 14px;
}

.character-item-id {
    font-size: 12px;
    opacity: 0.7;
}

.character-modified-star {
    color: #f39c12;
    font-size: 14px;
    margin-left: 5px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.character-item:hover .character-modified-star {
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.character-detail {
    flex: 1;
    background: var(--light-color);
    border-radius: 12px;
    padding: 20px;
    overflow-y: auto;
}

.detail-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--dark-color);
    text-align: center;
}

.detail-placeholder i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.detail-placeholder p {
    font-size: 18px;
    opacity: 0.7;
}

.character-form {
    display: none;
}

.character-form.active {
    display: block;
}

/* Compact sticky header for character detail */
.character-detail-header-sticky {
    display: flex;
    gap: 15px;
    padding: 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    margin-bottom: 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    align-items: center;
}

.character-image-preview-compact {
    flex: 0 0 120px;
}

.character-preview-img-compact {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 10px;
    border: 3px solid var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.character-basic-info-compact {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.compact-info-row {
    display: flex;
    gap: 20px;
    align-items: center;
}

.compact-field {
    flex: 1;
}

.compact-field label,
.compact-field-full label {
    font-size: 13px;
    color: #495057;
    margin: 0;
}

.compact-field strong {
    color: var(--dark-color);
    font-weight: 600;
    font-size: 14px;
}

.compact-field-full {
    width: 100%;
}

.info-note-compact {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #6c757d;
    opacity: 0.8;
}

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

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 8px;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 2px solid #ddd;
    margin-top: 20px;
}

.form-actions-left {
    display: flex;
    gap: 10px;
}

.form-actions-right {
    display: flex;
    gap: 10px;
}

/* Attributes Tab Styles */
.attributes-categories {
    flex: 0 0 300px;
    background: var(--light-color);
    border-radius: 12px;
    padding: 15px;
    overflow-y: auto;
}

.attributes-detail {
    flex: 1;
    background: var(--light-color);
    border-radius: 12px;
    padding: 20px;
    overflow-y: auto;
}

.categories-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.categories-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--dark-color);
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.category-item:hover {
    background: var(--primary-color);
    color: white;
    transform: translateX(5px);
}

.category-item.selected {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

.category-info {
    flex: 1;
}

.category-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
}

.category-count {
    font-size: 12px;
    opacity: 0.7;
}

.values-editor {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.value-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.value-item input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: var(--transition);
}

.value-item input:focus {
    border-color: var(--primary-color);
    outline: none;
}

.remove-value-btn {
    padding: 8px 10px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
}

.remove-value-btn:hover {
    background: #c0392b;
    transform: scale(1.05);
}

.add-value-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: var(--success-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
    margin-top: 10px;
}

.add-value-btn:hover {
    background: #27ae60;
    transform: translateY(-2px);
}

.attribute-category-form {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.save-character-btn {
    background: var(--success-color);
    color: white;
    border: none;
}

.save-character-btn:hover {
    background: #27ae60;
}

.cancel-character-btn {
    background: var(--danger-color);
    color: white;
    border: none;
}

.cancel-character-btn:hover {
    background: #c0392b;
}

/* Responsive Editor */
@media (max-width: 768px) {
    .editor-container {
        padding: 15px;
        height: calc(100vh - 30px);
    }
    
    .editor-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .editor-actions {
        justify-content: center;
    }
    
    .editor-content {
        flex-direction: column;
    }
    
    .character-list {
        width: 100%;
        max-height: 200px;
    }
    
    .questions-categories {
        width: 100%;
        max-height: 150px;
    }
    
    .question-inputs {
        grid-template-columns: 1fr;
    }
    
    .editor-tabs {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .editor-tab {
        flex: 1;
        min-width: 120px;
        justify-content: center;
    }
}

/* Animations for character cards */
@keyframes flipCard {
    0% {
        transform: rotateY(0);
    }
    50% {
        transform: rotateY(90deg);
    }
    100% {
        transform: rotateY(0);
    }
}

.character-card.flipping {
    animation: flipCard 0.6s ease-in-out;
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--light-color);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

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

/* Tooltip */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    color: var(--dark-color) !important; /* Dark text on white background */
    padding: 8px 12px;
    border-radius: 8px;
    border: 2px solid var(--primary-color); /* Nice blue border */
    font-size: 14px;
    font-family: 'Fredoka', sans-serif !important;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-bottom: 8px;
}

.tooltip:hover::after {
    opacity: 1;
}

/* Custom Modal */
.custom-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease-out;
}

.modal-dialog {
    position: relative;
    background: white;
    border-radius: 30px;
    padding: 40px;
    max-width: 600px;
    min-width: 50vw;
    width: 90%;
    min-height: 30vh;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalBounce 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes modalBounce {
    0% {
        opacity: 0;
        transform: scale(0.3) translateY(-50px);
    }
    50% {
        transform: scale(1.05) translateY(0);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-icon {
    font-size: 60px;
    margin-bottom: 20px;
    animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.modal-icon.success {
    color: var(--success-color);
}

.modal-icon.error {
    color: var(--danger-color);
}

.modal-icon.info {
    color: var(--secondary-color);
}

/* Special styling for question confirmation modals */
.modal-icon.question {
    color: #9b59b6;
    font-size: 50px;
    animation: iconPulse 3s ease-in-out infinite;
}

.modal-icon.warning {
    color: var(--accent-color);
}

.modal-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 15px;
}

.modal-message {
    font-size: 18px;
    color: var(--dark-color);
    line-height: 1.6;
    margin-bottom: 30px;
}

.modal-input {
    width: 100%;
    padding: 12px 15px;
    margin: 15px 0 20px 0;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: var(--transition);
    background: white;
}

.modal-input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Search Container */
.search-container {
    position: relative;
    margin-bottom: 25px;
    max-width: 350px;
    margin-left: auto;
    margin-right: auto;
}

.search-input {
    width: 100%;
    padding: 12px 45px 12px 15px;
    border: 2px solid #e1e1e1;
    border-radius: 25px;
    font-size: 16px;
    font-family: 'Fredoka', sans-serif;
    background: white;
    color: var(--dark-color);
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    background: #fafafa;
}

.search-input::placeholder {
    color: #999;
    font-style: italic;
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 16px;
    pointer-events: none;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.modal-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 15px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    min-width: 120px;
}

.modal-ok, .modal-yes {
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    color: white;
}

.modal-ok:hover, .modal-yes:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(241, 196, 15, 0.4);
}

.modal-no {
    background: var(--light-color);
    color: var(--dark-color);
}

.modal-no:hover {
    background: #bdc3c7; /* Silver */
    transform: translateY(-2px);
}

/* Modal shake animation for errors */
@keyframes modalShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

.modal-dialog.shake {
    animation: modalShake 0.5s ease-in-out;
}

/* Tutorial Styles */
.badge-new {
    position: absolute;
    top: -8px;
    right: 10px;
    background: linear-gradient(135deg, #f1c40f, #e74c3c);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 12px;
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}


.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tutorial-overlay.hidden {
    display: none;
}

.tutorial-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease-out;
}

.tutorial-content {
    position: relative;
    background: white;
    border-radius: 25px;
    padding: 40px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalBounce 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
}

.step-number {
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 20px;
    display: inline-block;
}

.step-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 20px;
    line-height: 1.2;
}

.step-description {
    font-size: 18px;
    color: var(--dark-color);
    line-height: 1.6;
    margin-bottom: 30px;
}

.step-visual {
    min-height: 200px;
    background: var(--light-color);
    border-radius: 20px;
    margin-bottom: 30px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 80px;
    position: relative;
    overflow: hidden;
}

.tutorial-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
}

.tutorial-overlay .tutorial-btn {
    padding: 15px 25px;
    border: none;
    border-radius: 15px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    min-width: 120px;
}

.tutorial-overlay .tutorial-btn:not(.primary) {
    background: var(--light-color);
    color: var(--dark-color);
}

.tutorial-overlay .tutorial-btn.primary {
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    color: white;
}

.tutorial-overlay .tutorial-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.skip-tutorial {
    background: transparent;
    border: none;
    color: #999;
    font-size: 14px;
    cursor: pointer;
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 10px;
    border-radius: 50%;
    transition: var(--transition);
}

.skip-tutorial:hover {
    color: var(--dark-color);
    background: var(--light-color);
}

/* Hint Bubble */
.hint-bubble {
    position: fixed;
    background: white;
    color: var(--dark-color);
    border: 2px solid var(--primary-color);
    padding: 15px 20px;
    border-radius: 20px;
    font-size: 16px;
    font-weight: 500;
    z-index: 9000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    animation: hintBounce 0.4s ease-out;
    max-width: 300px;
}

.hint-bubble.hidden {
    display: none;
}

@keyframes hintBounce {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.hint-arrow {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid white;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
}

.hint-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.hint-close {
    background: transparent;
    border: none;
    color: var(--dark-color); /* Black close button */
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: var(--transition);
}

.hint-close:hover {
    background: rgba(0, 0, 0, 0.1); /* Subtle dark hover effect */
    transform: scale(1.1);
}

/* Mode Selection on Main Screen */
.mode-selection-main {
    margin-top: 1rem;
    margin-bottom: 1.5rem;
}

.main-mode-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Old conflicting button styles removed - now using clean .menu-btn-square styles */

/* Mode Selection Screen Styles (removed - no longer needed) */
.mode-selection-container {
    text-align: center;
    padding: 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.mode-selection-title {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.mode-selection-title i {
    font-size: 2.5rem;
}

.mode-buttons {
    display: flex;
    gap: 2rem;
    justify-content: center;
    margin: 3rem 0;
    flex-wrap: wrap;
}

.mode-btn {
    background: white;
    border: 4px solid var(--primary-color);
    border-radius: var(--border-radius);
    padding: 2rem !important;
    min-width: 250px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 5px 15px var(--shadow-color);
}

.mode-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    border-color: var(--secondary-color);
}

.mode-btn i {
    font-size: 3rem;
    color: var(--primary-color);
}

.mode-btn h3 {
    font-size: 1.5rem;
    color: var(--dark-color);
    margin: 0.5rem 0;
}

.mode-btn p {
    color: #666;
    font-size: 0.9rem;
}

.team-mode {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
}

.solo-mode {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
}

/* Elimination Control Panel Styles */
.elimination-panel {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 3px solid var(--primary-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    display: none;
    flex-direction: column;
    gap: 1rem;
    min-width: 500px;
    max-width: 600px;
    animation: slideUp 0.3s ease;
}

.elimination-header {
    text-align: center;
    border-bottom: 2px solid var(--light-color);
    padding-bottom: 1rem;
}

.elimination-header h3 {
    color: var(--success-color);
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}

.elimination-tip {
    color: #666;
    font-size: 0.9rem;
    font-style: italic;
}

@keyframes slideUp {
    from {
        bottom: -100px;
        opacity: 0;
    }
    to {
        bottom: 20px;
        opacity: 1;
    }
}

.elimination-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 1rem 0;
}

.elimination-stats, .points-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1rem;
}

.elimination-info span {
    color: var(--dark-color) !important;
}

.count-badge, .points-badge, .points-badge-warning {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: bold;
}

.count-badge {
    background: var(--accent-color);
    color: white !important;
}

.points-badge {
    background: var(--success-color);
    color: white !important;
}

.points-badge-warning {
    background: var(--secondary-color);
    color: var(--dark-color) !important;
}

.elimination-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-eliminate {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff4757 100%) !important;
    color: white !important;
    border: none !important;
    padding: 0.75rem 1.5rem !important;
    border-radius: 10px;
    font-weight: 600 !important;
    cursor: pointer;
    transition: var(--transition);
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem;
}

.btn-eliminate:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(255, 71, 87, 0.4);
}

.btn-eliminate-all {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%) !important;
    color: white !important;
    border: none !important;
    padding: 0.75rem 1.5rem !important;
    border-radius: 10px;
    font-weight: 600 !important;
    cursor: pointer;
    transition: var(--transition);
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem;
}

.btn-eliminate-all:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(255, 152, 0, 0.4);
}

.btn-skip {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%) !important;
    color: white !important;
    border: none !important;
    padding: 0.75rem 1.5rem !important;
    border-radius: 10px;
    font-weight: 600 !important;
    cursor: pointer;
    transition: var(--transition);
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem;
}

.btn-skip:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.btn-recommended {
    animation: pulse 2s infinite;
    border: 2px solid var(--success-color) !important;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(46, 204, 113, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .mode-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .mode-btn {
        min-width: 200px;
        padding: 1.5rem !important;
    }
    
    .elimination-panel {
        min-width: 90%;
        padding: 1rem;
    }
    
    .elimination-buttons {
        flex-direction: column;
    }
    
    .btn-eliminate,
    .btn-eliminate-all,
    .btn-skip {
        width: 100%;
        justify-content: center !important;
    }
}

/* Character Tooltip System */
.character-tooltip {
    position: fixed;
    background: white;
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    border: 2px solid var(--primary-color);
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 280px;
    font-family: 'Fredoka', sans-serif;
}

.character-tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

.tooltip-content {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.tooltip-image {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid var(--light-color);
}

.tooltip-info {
    flex: 1;
}

.tooltip-name {
    font-size: 18px;
    font-weight: bold;
    color: var(--dark-color);
    margin-bottom: 8px;
    line-height: 1.2;
}

.tooltip-description {
    font-size: 14px;
    color: var(--dark-color);
    opacity: 0.8;
    line-height: 1.4;
    margin: 0;
}

.tooltip-attributes {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}

.tooltip-tag {
    background: var(--primary-color);
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

/* Git Version Footer */
.git-version-footer {
    position: fixed;
    bottom: 10px;
    right: 15px;
    z-index: 100;
    opacity: 0.6;
    transition: opacity 0.3s ease;
    pointer-events: none;
    user-select: none;
}

.git-version-footer:hover {
    opacity: 1;
}

.version-info {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.9);
    padding: 6px 12px;
    border-radius: 15px;
    font-family: 'Fredoka', sans-serif;
    font-size: 12px;
    color: #666;
    border: 1px solid rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.version-label {
    font-weight: 600;
    color: #555;
}

.version-hash {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 11px;
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 4px;
    color: #333;
    border: 1px solid #ddd;
}

.version-date {
    font-size: 10px;
    color: #888;
    font-style: italic;
}

/* Responsive adjustments for footer */
@media (max-width: 768px) {
    .git-version-footer {
        bottom: 2px; /* Align with AMEC footer */
        right: 10px;
    }
    
    .version-info {
        padding: 4px 8px;
        font-size: 10px;
        gap: 6px;
    }
    
    .version-hash {
        font-size: 9px;
        padding: 1px 4px;
    }
    
    .version-date {
        font-size: 8px;
    }
}

/* Dynamic Character Attributes */
.attribute-field {
    position: relative;
    margin-bottom: 20px;
    padding: 15px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    background: #fafbfc;
    transition: var(--transition);
}

.attribute-field:hover {
    border-color: var(--primary-color);
    background: white;
}

.attribute-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.attribute-header label {
    font-weight: 600;
    color: var(--dark-color);
    margin: 0;
}

.remove-attribute-btn {
    padding: 6px 8px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: var(--transition);
}

.remove-attribute-btn:hover {
    background: #c0392b;
    transform: scale(1.1);
}

.attribute-actions {
    text-align: center;
    padding: 20px 0;
    border-top: 2px solid #e1e8ed;
}

.attribute-actions .editor-btn {
    font-size: 16px;
    padding: 12px 20px;
}

/* Debug UI Ratio Display */
.debug-ratio {
    display: none; /* Hidden by default */
    position: fixed;
    bottom: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.15);
    color: rgba(255, 255, 255, 0.3);
    padding: 8px 12px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    z-index: 10000;
    user-select: none;
    pointer-events: auto;
    min-width: 120px;
    text-align: center;
    backdrop-filter: blur(2px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

.debug-ratio:hover {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transform: scale(1.05);
}

.debug-ratio span {
    color: rgba(0, 255, 0, 0.4);
    text-shadow: none;
    transition: all 0.3s ease;
}

.debug-ratio:hover span {
    color: #00ff00;
    text-shadow: 0 0 2px rgba(0, 255, 0, 0.3);
}