/* Game Play Page Specific Styles */

/* Game page body */
.game-page-body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
    background: #0a0a14; /* Dark blue-black base color */
    position: relative;
}

/* Achievement Notification Styles */
.achievement-notification {
    position: fixed;
    top: 80px; /* Moved down to avoid being off-screen */
    right: -400px;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(124, 58, 237, 0.3);
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 10000;
    transition: right 0.5s ease-out;
    max-width: 350px;
}

.achievement-notification.show {
    right: 20px;
}

.achievement-icon {
    font-size: 2.5rem;
    animation: bounce 1s ease-in-out infinite;
}

.achievement-content {
    flex: 1;
}

.achievement-title {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 5px;
}

.achievement-name {
    font-size: 1.2rem;
    font-weight: bold;
}

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

@media (max-width: 576px) {
    .achievement-notification {
        right: -100%;
        left: auto;
        top: 60px;
        max-width: calc(100% - 40px);
        margin: 0 20px;
    }
    
    .achievement-notification.show {
        right: auto;
        left: 50%;
        transform: translateX(-50%);
    }
}

/* Background animation */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: 
        linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%),
        radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 119, 198, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(120, 219, 255, 0.1) 0%, transparent 50%);
    filter: blur(80px);
    z-index: -1;
    animation: nebulaPulse 20s ease-in-out infinite;
}

@keyframes nebulaPulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* Game header wrapper - full width */
.game-header-wrapper {
    width: 100%;
    position: relative;
    z-index: 100;
    display: block;
}

/* Game header - full width background */
.game-header {
    background: rgba(248, 245, 255, 0.95);
    backdrop-filter: blur(30px);
    border-bottom: 1px solid rgba(147, 51, 234, 0.15);
    box-shadow: 0 4px 30px rgba(147, 51, 234, 0.1);
    width: 100%;
}

/* Header content - centered with max width */
.game-header .header-content {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
}

/* Game container - below header */
.game-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 80px); /* Adjust based on header height */
    height: calc(100dvh - 80px); /* Dynamic viewport height for mobile */
    color: white;
    position: relative;
    z-index: 10;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    overflow: hidden; /* Prevent scrolling */
}

.game-header h4 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #7c3aed;
    margin: 0;
}

/* Game main area */
.game-main {
    flex: 1;
    display: flex;
    flex-direction: row;
    overflow: hidden;
    width: 100%;
    justify-content: center;
    align-items: flex-start;
}

/* Canvas container */
.game-canvas-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    min-height: 0;
    flex-shrink: 0;
    padding: 20px;
    width: 60%;
    max-width: 600px;
    margin: 0 auto;
    flex: 1;
}

.canvas-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 3/4;
    max-height: 65vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Canvas overlay buttons */
.canvas-overlay-btn {
    position: absolute;
    top: 10px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    padding: 0;
}

.canvas-overlay-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
    box-shadow: 0 4px 20px rgba(255, 255, 255, 0.2);
}

.canvas-overlay-btn .btn-icon {
    font-size: 20px;
    line-height: 1;
}

.hint-overlay {
    left: 10px;
}

.shuffle-overlay {
    right: 10px;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 20px;
    box-shadow: 
        0 0 50px rgba(120, 119, 198, 0.3),
        0 0 100px rgba(120, 119, 198, 0.1),
        inset 0 0 20px rgba(255, 255, 255, 0.05);
    background: rgba(10, 10, 20, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Word input */
.word-input-container {
    position: relative;
    width: calc(100% - 20px);
    max-width: 500px;
    margin: 0 10px;
}

.word-input {
    width: 100%;
    padding: 15px 60px 15px 50px;
    font-size: 24px;
    font-weight: 600;
    text-align: center;
    background: rgba(30, 27, 75, 0.8);
    border: 2px solid rgba(124, 58, 237, 0.8);
    border-radius: 12px;
    color: white;
    outline: none;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.word-input:focus {
    background: rgba(30, 27, 75, 0.9);
    border-color: #64ffda;
    box-shadow: 0 0 20px rgba(100, 255, 218, 0.3);
}

.word-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
    text-transform: none;
    letter-spacing: normal;
}

/* Submit button */
.submit-word-btn {
    position: absolute;
    right: 2px;
    top: 2px;
    bottom: 2px;
    transform: none;
    background: linear-gradient(135deg, #64ffda 0%, #4dd9cc 100%);
    color: #333;
    border: none;
    width: auto;
    height: auto;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: bold;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(100, 255, 218, 0.3);
    padding: 0 20px;
}

.submit-word-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #4dd9cc 0%, #3aa39f 100%);
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(100, 255, 218, 0.4);
}

.submit-word-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Submit button text - show ENTER on desktop */
@media (min-width: 769px) {
    .submit-word-btn {
        right: 2px !important;
    }
}

.submit-word-btn .mobile-text {
    display: inline;
}

.submit-word-btn .desktop-arrow {
    display: none;
}

/* Show arrow on desktop instead of text */
@media (min-width: 769px) {
    .submit-word-btn .mobile-text {
        display: none;
    }
    
    .submit-word-btn .desktop-arrow {
        display: inline;
        font-size: 24px;
        font-weight: bold;
    }
}

/* Delete button */
.delete-btn {
    display: none;
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 107, 107, 0.2);
    color: #ff6b6b;
    border: 1px solid #ff6b6b;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s ease;
}

.delete-btn:hover {
    background: rgba(255, 107, 107, 0.3);
    transform: translateY(-50%) scale(1.1);
}

/* Clear input button */
.clear-input-btn {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 107, 107, 0.2);
    color: #ff6b6b;
    border: 1px solid rgba(255, 107, 107, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.clear-input-btn:hover {
    background: rgba(255, 107, 107, 0.3);
    transform: translateY(-50%) scale(1.1);
}

.clear-input-btn .btn-icon {
    font-size: 16px;
    line-height: 1;
}

/* Desktop sidebar */
.game-sidebar {
    width: 40%;
    max-width: 400px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: 25px;
    border-left: 1px solid rgba(147, 51, 234, 0.2);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 25px;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.game-sidebar h4 {
    border-bottom: 1px solid rgba(147, 51, 234, 0.2);
    padding-bottom: 10px;
    margin-bottom: 15px;
    color: #7c3aed;
    font-weight: 700;
}

/* Mobile info section - hidden by default */
.game-info-section {
    display: none;
    background: rgba(255, 255, 255, 0.95);
    color: #1f2937;
}

/* Found words section */
.found-words-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.found-words-section h6 {
    margin-bottom: 15px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #7c3aed;
}

/* Word list */
.word-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    background: rgba(147, 51, 234, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(147, 51, 234, 0.1);
    max-height: calc(100vh - 450px);
}

.word-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(147, 51, 234, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(147, 51, 234, 0.1);
    transition: all 0.3s ease;
    margin-bottom: 4px;
}

.word-entry:hover {
    background: rgba(147, 51, 234, 0.12);
    transform: translateX(3px);
    border-color: rgba(147, 51, 234, 0.2);
}

.word-entry .word {
    font-weight: 600;
    color: #1f2937;
}

.word-entry .points {
    color: #7c3aed;
    font-weight: bold;
}

/* Progress bar */
.progress-bar {
    height: 12px;
    background: rgba(147, 51, 234, 0.1);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #7c3aed, #ec4899, #64ffda);
    border-radius: 6px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.5);
}

/* Rank indicator */
.rank-indicator {
    text-align: center;
    font-weight: 700;
    font-size: 1.1rem;
    color: #7c3aed;
    background: rgba(124, 58, 237, 0.15);
    padding: 8px 20px;
    border-radius: 20px;
    display: inline-block;
    border: 2px solid rgba(124, 58, 237, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Cosmic buttons */
.cosmic-btn {
    position: relative;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 12px 20px;
    color: white;
    font-weight: 500;
    font-size: 14px;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    backdrop-filter: blur(10px);
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Space-themed buttons */
.cosmic-btn.space-btn {
    border-radius: 50px;
    background: linear-gradient(135deg, rgba(100, 100, 255, 0.2) 0%, rgba(150, 100, 255, 0.1) 100%);
    border: 2px solid rgba(100, 150, 255, 0.4);
    box-shadow: 
        0 0 20px rgba(100, 150, 255, 0.3),
        inset 0 0 10px rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: visible;
}

.cosmic-btn.space-btn::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #64ffda, #7c3aed, #ff6b6b, #64ffda);
    border-radius: 50px;
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
    animation: space-glow 3s linear infinite;
}

@keyframes space-glow {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

.cosmic-btn.space-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 
        0 5px 30px rgba(100, 150, 255, 0.5),
        inset 0 0 15px rgba(255, 255, 255, 0.2);
}

.cosmic-btn.space-btn:hover::before {
    opacity: 0.7;
}

.cosmic-btn:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.06) 100%);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.cosmic-btn .btn-icon {
    font-size: 20px;
    display: inline-block;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cosmic-btn:hover .btn-icon {
    transform: scale(1.2);
}

.cosmic-btn .btn-text {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Control buttons */
.control-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 0;
}

.control-buttons .cosmic-btn {
    background: rgba(248, 245, 255, 0.95);
    border: 2px solid rgba(147, 51, 234, 0.2);
    color: #7c3aed;
    flex: 1;
    min-height: 48px;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.control-buttons .cosmic-btn:hover {
    background: white;
    border-color: rgba(147, 51, 234, 0.4);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(147, 51, 234, 0.2);
}

.control-buttons .cosmic-btn .btn-text {
    color: #7c3aed;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Word feedback */
.word-feedback {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    padding: 12px 24px;
    border-radius: 25px;
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.word-feedback.valid {
    background-color: rgba(76, 175, 80, 0.95);
    animation: bounceIn 0.5s ease;
}

.word-feedback.invalid {
    background-color: rgba(244, 67, 54, 0.95);
    animation: shake 0.5s ease;
}

.word-feedback.neutral {
    background-color: rgba(33, 150, 243, 0.95);
}

.word-feedback.show {
    opacity: 1;
}

/* Pangram celebration notification */
.pangram-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    text-align: center;
    padding: 40px 60px;
    border-radius: 30px;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FF6347 100%);
    color: white;
    font-weight: 900;
    font-size: 2.5rem;
    z-index: 10002;
    pointer-events: none;
    box-shadow: 0 10px 50px rgba(255, 215, 0, 0.5), 0 0 100px rgba(255, 215, 0, 0.3);
    animation: pangramCelebration 2s ease-out;
}

.pangram-notification .pangram-text {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.pangram-notification .pangram-bonus {
    font-size: 3rem;
    color: #FFD700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 0 0 40px rgba(255, 215, 0, 0.6);
    animation: glow 1s ease-in-out infinite alternate;
}

@keyframes pangramCelebration {
    0% {
        transform: translate(-50%, -50%) scale(0) rotate(0deg);
        opacity: 0;
    }
    20% {
        transform: translate(-50%, -50%) scale(1.3) rotate(10deg);
        opacity: 1;
    }
    40% {
        transform: translate(-50%, -50%) scale(0.9) rotate(-5deg);
    }
    60% {
        transform: translate(-50%, -50%) scale(1.1) rotate(5deg);
    }
    80% {
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
        opacity: 0;
    }
}

@keyframes glow {
    from {
        text-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 0 0 40px rgba(255, 215, 0, 0.6);
    }
    to {
        text-shadow: 0 0 30px rgba(255, 215, 0, 1), 0 0 60px rgba(255, 215, 0, 0.8);
    }
}

@keyframes bounceIn {
    0% {
        transform: translateX(-50%) scale(0.3);
        opacity: 0;
    }
    50% {
        transform: translateX(-50%) scale(1.1);
    }
    70% {
        transform: translateX(-50%) scale(0.9);
    }
    100% {
        transform: translateX(-50%) scale(1);
        opacity: 1;
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(-50%);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(calc(-50% - 10px));
    }
    20%, 40%, 60%, 80% {
        transform: translateX(calc(-50% + 10px));
    }
}

/* Mobile styles - aggressive space saving */
@media (max-width: 768px) {
    /* Hide header on mobile */
    .game-header-wrapper {
        display: none !important;
    }
    
    .game-header .header-content {
        padding: 10px 15px;
    }
    
    .game-header h4 {
        font-size: 1.2rem;
    }
    
    .game-header .game-controls {
        display: none; /* Hide desktop controls on mobile */
    }
    
    /* Show delete button on mobile */
    .mobile-only {
        display: flex !important;
    }
    
    body {
        overflow: hidden;
        margin: 0;
        padding: 0;
    }
    
    .game-container {
        height: calc(100vh - 50px);
        height: calc(100dvh - 50px); /* Dynamic viewport height */
        height: calc(var(--vh, 1vh) * 100 - 50px); /* Custom viewport height */
        overflow: hidden;
        max-height: -webkit-fill-available;
        display: flex;
        flex-direction: column;
        padding: 0;
        margin: 0;
        position: relative;
    }
    
    .game-main {
        flex-direction: column;
        height: 100%;
        margin: 0;
        padding: 0;
        overflow: hidden;
        display: flex;
        flex: 1;
        /* Reserve space for fixed bottom section to ensure visibility - reduced for more canvas space */
        padding-bottom: 120px; /* Base padding for bottom section - reduced from 140px */
        padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px)); /* Add safe area */
        padding-bottom: calc(120px + constant(safe-area-inset-bottom)); /* iOS 11 fallback */
    }
    
    .game-sidebar {
        display: none;
    }
    
    /* Show mobile info section - FIXED POSITION at bottom */
    .game-info-section {
        display: flex;
        flex-direction: column;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        /* width: 100%; */
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        padding: 12px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        padding-bottom: calc(12px + constant(safe-area-inset-bottom)); /* iOS 11 fallback */
        border-top: 2px solid rgba(147, 51, 234, 0.3);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
        z-index: 100;
        color: #1f2937;
        /* Ensure minimum height for touch targets */
        min-height: 120px;
        align-items: center; /* Center horizontally */
        /* Account for border in width calculation */
        box-sizing: border-box;
    }
    
    /* Score display at top - more compact */
    .mobile-score-top {
        margin-bottom: 2px !important;
        padding: 3px !important;
        border-radius: 6px !important;
    }
    
    .mobile-score-top > div {
        gap: 4px !important;
        margin-bottom: 1px !important;
    }
    
    .mobile-rank-display {
        font-size: 0.85rem !important;
        padding: 2px 8px !important;
    }
    
    .mobile-score-top span {
        font-size: 0.95rem !important;
    }
    
    /* Next rank info on mobile */
    .mobile-next-rank {
        font-size: 0.7rem;
        color: rgba(255, 255, 255, 0.8);
        margin-bottom: 2px;
        text-align: center;
        line-height: 1;
    }
    
    .progress {
        height: 2px !important;
    }
    
    .game-canvas-container {
        padding: 8px;
        gap: 8px;
        width: 100%;
        max-width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        min-height: 0;
    }
    
    .word-input-container {
        max-width: 100%;
        width: calc(100% - 8px);
        margin: 0 4px;
        flex-shrink: 0;
        height: 54px;
    }
    
    .word-input {
        font-size: 20px !important;
        padding: 12px 95px 12px 90px;
        letter-spacing: 0.5px;
        height: 48px;
        border-radius: 10px;
    }
    
    .canvas-wrapper {
        max-width: 100%;
        width: 100%;
        /* Calculate height: full height - word input (54px) - gaps (16px) - padding (16px) */
        height: calc(100% - 86px);
        /* Maximum height to ensure bottom buttons are visible - reduced from 250px to 200px for more canvas space */
        max-height: calc(100vh - 200px);
        max-height: calc(100dvh - 200px);
        max-height: calc((var(--vh, 1vh) * 100) - 200px);
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
        min-height: 0;
        aspect-ratio: unset;
    }
    
    /* Canvas overlay buttons on mobile */
    .canvas-overlay-btn {
        width: 36px;
        height: 36px;
        top: 8px;
    }
    
    .canvas-overlay-btn .btn-icon {
        font-size: 18px;
    }
    
    .hint-overlay {
        left: 8px;
    }
    
    .shuffle-overlay {
        right: 8px;
    }
    
    #gameCanvas {
        width: 100%;
        height: 100%;
        max-width: min(100%, 400px); /* Limit max width for very wide screens */
        max-height: 100%;
        border-radius: 12px;
        margin: 0 auto;
    }
    
    /* Make control buttons bigger on mobile for better touch targets */
    .control-buttons {
        margin: 8px 0 !important;
        gap: 8px !important;
        flex-shrink: 0; /* Prevent compression */
    }
    
    .control-buttons .cosmic-btn {
        padding: 10px 14px !important;
        min-height: 44px !important;
        font-size: 0.85rem !important;
        border-radius: 10px !important;
        flex-shrink: 0; /* Prevent compression */
    }
    
    .control-buttons .cosmic-btn .btn-icon {
        font-size: 1.1rem !important;
        margin: 0 !important;
    }
    
    .control-buttons .cosmic-btn .btn-text {
        font-size: 0.75rem !important;
        letter-spacing: 0.5px !important;
    }
    
    /* Game control buttons on mobile */
    .game-control-buttons {
        margin: 8px auto !important;
        gap: 8px !important;
        flex-shrink: 0; /* Prevent compression */
        display: flex;
        justify-content: center;
        align-items: center;
        width: 100%;
        max-width: 320px; /* Prevent buttons from stretching too wide */
        padding: 0; /* Ensure no extra padding */
    }
    
    .game-control-buttons .cosmic-btn {
        padding: 10px 14px !important;
        min-height: 44px !important;
        font-size: 0.85rem !important;
        border-radius: 25px !important;
        flex-shrink: 0; /* Prevent compression */
    }
    
    /* Space buttons on mobile */
    .game-control-buttons .cosmic-btn.space-btn {
        border-radius: 30px !important;
    }
    
    .game-control-buttons .cosmic-btn .btn-icon {
        font-size: 1.1rem !important;
        margin: 0 !important;
        margin-right: 3px !important;
    }
    
    .game-control-buttons .cosmic-btn .btn-text {
        font-size: 0.75rem !important;
        letter-spacing: 0.5px !important;
    }
    
    /* Dark button text for better visibility */
    .game-control-buttons button {
        color: #333 !important;
    }
    
    .clear-input-btn {
        width: 26px;
        height: 26px;
        left: 8px;
    }
    
    .clear-input-btn .btn-icon {
        font-size: 14px;
    }
    
    .submit-word-btn {
        width: auto;
        height: 36px;
        padding: 0 16px;
        font-size: 14px;
        right: 5px;
        border-radius: 18px;
        background: linear-gradient(135deg, #64ffda 0%, #4dd9cc 100%);
        box-shadow: 0 4px 20px rgba(100, 255, 218, 0.4);
    }
    
    .submit-word-btn .mobile-text {
        display: inline;
        font-weight: 700;
        letter-spacing: 1px;
    }
    
    .submit-word-btn .desktop-arrow {
        display: none;
    }
    
    .submit-word-btn:not(:disabled) {
        animation: pulse-glow 2s ease-in-out infinite;
    }
    
    @keyframes pulse-glow {
        0%, 100% { box-shadow: 0 4px 20px rgba(100, 255, 218, 0.4); }
        50% { box-shadow: 0 4px 30px rgba(100, 255, 218, 0.6); }
    }
    
    .delete-btn {
        width: 34px !important;
        height: 34px !important;
        font-size: 18px !important;
        right: auto;
        left: 50px;
    }
    
    /* Word feedback position - above fixed bottom section */
    .word-feedback {
        font-size: 1rem;
        padding: 10px 20px;
    }
    
    .pangram-notification {
        padding: 30px 40px;
        font-size: 2rem;
    }
    
    .pangram-notification .pangram-bonus {
        font-size: 2.5rem;
    }
    
    .word-feedback {
        bottom: calc(130px + env(safe-area-inset-bottom, 0px));
        padding: 6px 12px;
        font-size: 0.8rem;
        z-index: 101; /* Above the fixed bottom section */
    }
}

/* Found words list styling */
#wordList h6, #wordListMobile h6,
.found-words-section h6 {
    color: #7c3aed !important;
    font-weight: 700 !important;
}

#wordList .text-muted, #wordListMobile .text-muted {
    color: #6b7280 !important;
}

.badge.bg-secondary {
    background-color: rgba(147, 51, 234, 0.2) !important;
    color: #7c3aed !important;
    font-weight: 600;
    padding: 4px 10px;
    font-size: 0.85rem;
}

/* Score and progress section */
.score-progress-row {
    background: rgba(124, 58, 237, 0.08);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid rgba(124, 58, 237, 0.15);
}

.score-progress-row h5 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.score-progress-row h5 strong {
    font-size: 1.8rem;
    color: white;
    background: linear-gradient(135deg, #7c3aed 0%, #9333ea 100%);
    padding: 8px 18px;
    border-radius: 25px;
    display: inline-block;
    min-width: 60px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
    border: 2px solid rgba(147, 51, 234, 0.2);
}

.score-progress-row small {
    font-size: 1.1rem;
    font-weight: 600;
}

.score-progress-row .text-muted {
    color: #6b7280 !important;
    font-size: 0.95rem;
    font-weight: 500;
    margin-top: 8px;
}

/* Next rank info above progress bar */
.next-rank-info {
    text-align: center;
    margin-bottom: 10px;
    font-size: 0.95rem;
    color: #6b7280;
    font-weight: 500;
}

/* Header buttons styling */
#helpBtn, #endGameBtn, #exitBtn {
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#helpBtn {
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    border: none;
    color: white;
    font-size: 1rem;
    width: auto;
    height: auto;
    padding: 8px 20px;
    border-radius: 8px;
}

#helpBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

#endGameBtn {
    background: rgba(251, 191, 36, 0.9);
    border: 1px solid rgba(245, 158, 11, 0.9);
    color: white;
}

#endGameBtn:hover {
    background: rgba(245, 158, 11, 1);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(251, 191, 36, 0.4);
}

#exitBtn {
    background: rgba(124, 58, 237, 0.8);
    border: 1px solid rgba(124, 58, 237, 0.9);
    color: white;
}

#exitBtn:hover {
    background: rgba(124, 58, 237, 1);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
}

/* Mobile score display */
.mobile-score-top {
    background: rgba(30, 27, 75, 0.8);
    padding: 10px;
    border-radius: 10px;
    border: 1px solid rgba(124, 58, 237, 0.5);
    margin-bottom: 15px !important;
}

.mobile-score-top h5 {
    color: white !important;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Mobile rank display in bottom section */
.mobile-rank-display {
    font-size: 1.4rem;
    font-weight: 700;
    color: #64ffda;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
    background: rgba(100, 255, 218, 0.15);
    padding: 5px 15px;
    border-radius: 20px;
    display: inline-block;
    text-shadow: 0 0 10px rgba(100, 255, 218, 0.5);
}

/* Removed ultra-compact layout - using reasonable sizes for all mobile devices */