@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Rajdhani:wght@400;500;600;700&display=swap');

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

body {
    font-family: 'Rajdhani', 'Orbitron', monospace;
    background: #000000;
    color: #00ff41;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
    padding: 0;
    margin: 0;
}

/* Matrix Rain Background */
.matrix-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(45deg, #000000, #001100, #000000);
}

.matrix-rain {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.matrix-column {
    position: absolute;
    top: -100%;
    color: #00ff41;
    font-family: 'Orbitron', monospace;
    font-size: 18px;
    font-weight: 400;
    text-shadow: 0 0 10px #00ff41;
    animation: matrix-fall linear infinite;
    white-space: nowrap;
}

@keyframes matrix-fall {
    0% { top: -100%; opacity: 1; }
    90% { opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

/* Cyberpunk Grid Overlay */
.cyber-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-image: 
        linear-gradient(rgba(0, 255, 65, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 65, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: grid-pulse 4s ease-in-out infinite;
}

@keyframes grid-pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

/* Holographic Scanlines */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(transparent 50%, rgba(0, 255, 65, 0.05) 50%);
    background-size: 100% 4px;
    animation: scanlines-move 0.1s linear infinite;
}

@keyframes scanlines-move {
    0% { background-position: 0 0; }
    100% { background-position: 0 4px; }
}

.container {
    max-width: 500px;
    width: 100%;
    margin: 20px auto;
    padding: 20px;
    z-index: 10;
    position: relative;
    background: rgba(0, 0, 0, 0.85);
    border: 2px solid #00ff41;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    box-shadow: 
        0 0 30px rgba(0, 255, 65, 0.5),
        inset 0 0 30px rgba(0, 255, 65, 0.1);
    animation: container-glow 3s ease-in-out infinite alternate;
    min-height: auto;
}

@keyframes container-glow {
    0% { box-shadow: 0 0 30px rgba(0, 255, 65, 0.5), inset 0 0 30px rgba(0, 255, 65, 0.1); }
    100% { box-shadow: 0 0 50px rgba(0, 255, 65, 0.8), inset 0 0 50px rgba(0, 255, 65, 0.2); }
}

header {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 2px solid #00ff41;
    padding-bottom: 20px;
    position: relative;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.theme-toggle {
    z-index: 100;
}

.toggle-btn {
    background: linear-gradient(135deg, #001100, #003300);
    border: 2px solid #00ff41;
    border-radius: 25px;
    color: #00ff41;
    font-family: 'Orbitron', monospace;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.3);
}

.toggle-btn:hover {
    background: linear-gradient(135deg, #003300, #006600);
    color: #00ffff;
    border-color: #00ffff;
    box-shadow: 0 0 25px rgba(0, 255, 255, 0.5);
    transform: translateY(-2px);
}

.toggle-icon {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.toggle-btn:hover .toggle-icon {
    transform: rotate(180deg);
}

.matrix-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    font-family: 'Orbitron', monospace;
    font-size: 0.8rem;
    color: #00ff41;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-group label {
    min-width: 60px;
    font-size: 0.75rem;
}

.matrix-selector {
    background: linear-gradient(135deg, #001100, #003300);
    border: 2px solid #00ff41;
    border-radius: 6px;
    color: #00ff41;
    font-family: 'Orbitron', monospace;
    font-size: 0.7rem;
    padding: 4px 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 8px rgba(0, 255, 65, 0.3);
    min-width: 80px;
    outline: none;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
}

.matrix-selector:hover {
    background: linear-gradient(135deg, #003300, #006600);
    color: #00ffff;
    border-color: #00ffff;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
}

.matrix-selector:focus {
    outline: none;
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.8);
}

.matrix-selector option {
    background: #001100;
    color: #00ff41;
    padding: 4px;
}

/* Background Styles */
.matrix-bg.void {
    background: radial-gradient(circle at center, #000011, #000000);
}

.matrix-bg.neon {
    background: linear-gradient(45deg, #001122, #002211, #110022);
}

.matrix-bg.circuit {
    background: linear-gradient(45deg, #001100, #000011, #110000);
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(0, 255, 65, 0.1) 2px, transparent 2px),
        radial-gradient(circle at 75% 75%, rgba(0, 255, 255, 0.1) 2px, transparent 2px);
    background-size: 40px 40px;
}

.matrix-bg.galaxy {
    background: radial-gradient(ellipse at center, #001122 0%, #000011 50%, #000000 100%);
    background-image: 
        radial-gradient(circle at 20% 20%, rgba(0, 255, 65, 0.3) 1px, transparent 1px),
        radial-gradient(circle at 80% 80%, rgba(0, 255, 255, 0.3) 1px, transparent 1px),
        radial-gradient(circle at 60% 40%, rgba(255, 0, 128, 0.2) 1px, transparent 1px);
    background-size: 60px 60px, 80px 80px, 100px 100px;
}

/* Grid variations */
.cyber-grid.void {
    background-image: 
        linear-gradient(rgba(0, 100, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 100, 255, 0.1) 1px, transparent 1px);
}

.cyber-grid.neon {
    background-image: 
        linear-gradient(rgba(255, 0, 128, 0.15) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 0, 128, 0.15) 1px, transparent 1px);
}

.cyber-grid.circuit {
    background-image: 
        linear-gradient(rgba(0, 255, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 255, 0.1) 1px, transparent 1px);
}

.cyber-grid.galaxy {
    background-image: 
        linear-gradient(rgba(255, 255, 0, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 0, 0.1) 1px, transparent 1px);
}

/* Hide matrix controls in classic theme */
body.classic-theme .matrix-controls {
    display: none;
}

body.classic-theme .controls {
    justify-content: flex-end;
}

h1 {
    font-family: 'Orbitron', monospace;
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: 0.3rem;
    color: #00ff41;
    text-shadow: 
        0 0 10px #00ff41,
        0 0 20px #00ff41,
        0 0 30px #00ff41;
    animation: title-pulse 2s ease-in-out infinite;
    position: relative;
}

h1::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 65, 0.4), transparent);
    animation: title-scan 3s linear infinite;
}

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

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

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
}

.message {
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    font-family: 'Orbitron', monospace;
    text-transform: uppercase;
    letter-spacing: 0.1rem;
    text-shadow: 0 0 10px currentColor;
}

.message.error {
    color: #ff0080;
    animation: error-flash 0.5s ease-in-out 3;
}

.message.success {
    color: #00ffff;
    animation: success-glow 1s ease-in-out infinite alternate;
}

@keyframes error-flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

@keyframes success-glow {
    0% { text-shadow: 0 0 10px #00ffff; }
    100% { text-shadow: 0 0 20px #00ffff, 0 0 30px #00ffff; }
}

.board {
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    gap: 8px;
    margin-bottom: 25px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 15px;
    border: 1px solid #00ff41;
    box-shadow: inset 0 0 20px rgba(0, 255, 65, 0.2);
}

.row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.tile {
    width: 65px;
    height: 65px;
    border: 2px solid #00ff41;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.2rem;
    font-weight: 700;
    font-family: 'Orbitron', monospace;
    text-transform: uppercase;
    background: rgba(0, 0, 0, 0.8);
    color: #00ff41;
    border-radius: 10px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.tile::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 65, 0.4), transparent);
    transition: left 0.5s ease;
}

.tile:hover::before {
    left: 100%;
}

.tile.filled {
    border-color: #00ffff;
    background: rgba(0, 255, 255, 0.1);
    color: #00ffff;
    text-shadow: 0 0 10px #00ffff;
    animation: tile-activate 0.3s ease-in-out;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
}

@keyframes tile-activate {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.tile.correct {
    background: linear-gradient(135deg, #00ff41, #00cc33);
    border-color: #00ff41;
    color: #000000;
    font-weight: 900;
    text-shadow: 0 0 10px #00ff41;
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.8);
}

.tile.present {
    background: linear-gradient(135deg, #ffff00, #ff8800);
    border-color: #ffff00;
    color: #000000;
    font-weight: 900;
    text-shadow: 0 0 10px #ffff00;
    box-shadow: 0 0 20px rgba(255, 255, 0, 0.8);
}

.tile.absent {
    background: linear-gradient(135deg, #ff0080, #800040);
    border-color: #ff0080;
    color: #ffffff;
    font-weight: 900;
    text-shadow: 0 0 10px #ff0080;
    box-shadow: 0 0 20px rgba(255, 0, 128, 0.8);
}

.tile.reveal {
    animation: cyber-flip 0.8s ease-in-out;
}

@keyframes cyber-flip {
    0% { transform: rotateY(0) scale(1); }
    25% { transform: rotateY(45deg) scale(1.1); }
    50% { transform: rotateY(90deg) scale(1.2); }
    75% { transform: rotateY(135deg) scale(1.1); }
    100% { transform: rotateY(180deg) scale(1); }
}

.keyboard {
    width: 100%;
    max-width: 500px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 15px;
    padding: 15px;
    border: 1px solid #00ff41;
    box-shadow: 0 0 25px rgba(0, 255, 65, 0.3);
}

.keyboard-row {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
    gap: 8px;
}

.key {
    background: linear-gradient(135deg, #001100, #003300);
    border: 2px solid #00ff41;
    border-radius: 8px;
    color: #00ff41;
    font-weight: 700;
    font-family: 'Orbitron', monospace;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
    text-shadow: 0 0 5px #00ff41;
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.3);
}

.key::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 65, 0.3), transparent);
    transition: left 0.3s ease;
}

.key:hover {
    background: linear-gradient(135deg, #003300, #006600);
    border-color: #00ffff;
    color: #00ffff;
    text-shadow: 0 0 10px #00ffff;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
    transform: translateY(-2px);
}

.key:hover::before {
    left: 100%;
}

.key:active {
    transform: translateY(0);
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.8);
}

.key.letter {
    width: 48px;
    height: 62px;
    font-size: 1.3rem;
}

.key.wide {
    width: 75px;
    height: 62px;
    font-size: 0.9rem;
}

.key.correct {
    background: linear-gradient(135deg, #00ff41, #00cc33);
    border-color: #00ff41;
    color: #000000;
    text-shadow: 0 0 10px #00ff41;
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.8);
}

.key.present {
    background: linear-gradient(135deg, #ffff00, #ff8800);
    border-color: #ffff00;
    color: #000000;
    text-shadow: 0 0 10px #ffff00;
    box-shadow: 0 0 20px rgba(255, 255, 0, 0.8);
}

.key.absent {
    background: linear-gradient(135deg, #ff0080, #800040);
    border-color: #ff0080;
    color: #ffffff;
    text-shadow: 0 0 10px #ff0080;
    box-shadow: 0 0 20px rgba(255, 0, 128, 0.8);
}

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: linear-gradient(135deg, #001100, #003300);
    margin: 10% auto;
    padding: 40px;
    border: 3px solid #00ff41;
    border-radius: 20px;
    width: 90%;
    max-width: 450px;
    text-align: center;
    box-shadow: 
        0 0 50px rgba(0, 255, 65, 0.8),
        inset 0 0 30px rgba(0, 255, 65, 0.1);
    animation: modal-appear 0.5s ease-out;
    position: relative;
    overflow: hidden;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent, rgba(0, 255, 65, 0.1), transparent);
    animation: modal-scan 3s linear infinite;
}

@keyframes modal-appear {
    0% { opacity: 0; transform: scale(0.8) rotateY(-90deg); }
    100% { opacity: 1; transform: scale(1) rotateY(0); }
}

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

.modal-content h2 {
    margin-bottom: 20px;
    font-size: 2.2rem;
    font-family: 'Orbitron', monospace;
    color: #00ff41;
    text-shadow: 0 0 20px #00ff41;
    animation: modal-title-pulse 2s ease-in-out infinite;
}

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

.modal-content p {
    margin-bottom: 30px;
    font-size: 1.3rem;
    line-height: 1.6;
    font-family: 'Rajdhani', monospace;
    color: #00ffff;
    text-shadow: 0 0 10px #00ffff;
    font-weight: 500;
}

#play-again-btn {
    background: linear-gradient(135deg, #00ff41, #00cc33);
    color: #000000;
    border: 2px solid #00ff41;
    padding: 15px 30px;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: 'Orbitron', monospace;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.5);
}

#play-again-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.3s ease;
}

#play-again-btn:hover {
    background: linear-gradient(135deg, #00ffff, #0099cc);
    border-color: #00ffff;
    color: #000000;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.8);
    transform: translateY(-3px);
}

#play-again-btn:hover::before {
    left: 100%;
}

#play-again-btn:active {
    transform: translateY(0);
}

/* Classic Theme Styles */
body.classic-theme {
    background-color: #121213;
    color: #ffffff;
    font-family: 'Helvetica Neue', Arial, sans-serif;
}

body.classic-theme .matrix-bg,
body.classic-theme .cyber-grid,
body.classic-theme .scanlines,
body.classic-theme .matrix-rain {
    display: none;
}

body.classic-theme .container {
    background: #121213;
    border: 1px solid #3a3a3c;
    box-shadow: none;
    animation: none;
}

body.classic-theme header {
    border-bottom: 1px solid #3a3a3c;
}

body.classic-theme h1 {
    color: #ffffff;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    font-size: 2.5rem;
    font-weight: bold;
    text-shadow: none;
    animation: none;
}

body.classic-theme h1::before {
    display: none;
}

body.classic-theme .toggle-btn {
    background: #818384;
    border: 2px solid #565758;
    color: #ffffff;
    box-shadow: none;
}

body.classic-theme .toggle-btn:hover {
    background: #565758;
    color: #ffffff;
    border-color: #565758;
    box-shadow: none;
}

body.classic-theme .board {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}

body.classic-theme .tile {
    background-color: #121213;
    border: 2px solid #3a3a3c;
    color: #ffffff;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    text-shadow: none;
    box-shadow: none;
}

body.classic-theme .tile::before {
    display: none;
}

body.classic-theme .tile.filled {
    border-color: #565758;
    background-color: #121213;
    color: #ffffff;
    text-shadow: none;
    box-shadow: none;
}

body.classic-theme .tile.correct {
    background-color: #538d4e;
    border-color: #538d4e;
    color: white;
    text-shadow: none;
    box-shadow: none;
}

body.classic-theme .tile.present {
    background-color: #b59f3b;
    border-color: #b59f3b;
    color: white;
    text-shadow: none;
    box-shadow: none;
}

body.classic-theme .tile.absent {
    background-color: #3a3a3c;
    border-color: #3a3a3c;
    color: white;
    text-shadow: none;
    box-shadow: none;
}

body.classic-theme .keyboard {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}

body.classic-theme .key {
    background-color: #818384;
    border: none;
    color: white;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    text-shadow: none;
    box-shadow: none;
    border-radius: 4px;
}

body.classic-theme .key::before {
    display: none;
}

body.classic-theme .key:hover {
    background-color: #565758;
    color: white;
    text-shadow: none;
    box-shadow: none;
    transform: none;
}

body.classic-theme .key.correct {
    background-color: #538d4e;
    color: white;
    text-shadow: none;
    box-shadow: none;
}

body.classic-theme .key.present {
    background-color: #b59f3b;
    color: white;
    text-shadow: none;
    box-shadow: none;
}

body.classic-theme .key.absent {
    background-color: #3a3a3c;
    color: white;
    text-shadow: none;
    box-shadow: none;
}

body.classic-theme .message.error {
    color: #f87171;
    text-shadow: none;
    animation: none;
}

body.classic-theme .message.success {
    color: #34d399;
    text-shadow: none;
    animation: none;
}

body.classic-theme .modal {
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: none;
}

body.classic-theme .modal-content {
    background-color: #121213;
    border: 1px solid #3a3a3c;
    box-shadow: none;
    animation: none;
}

body.classic-theme .modal-content::before {
    display: none;
}

body.classic-theme .modal-content h2 {
    color: #ffffff;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    text-shadow: none;
    animation: none;
}

body.classic-theme .modal-content p {
    color: #ffffff;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    text-shadow: none;
}

body.classic-theme #play-again-btn {
    background-color: #538d4e;
    border: none;
    color: white;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    text-transform: none;
    box-shadow: none;
}

body.classic-theme #play-again-btn::before {
    display: none;
}

body.classic-theme #play-again-btn:hover {
    background-color: #466a3a;
    color: white;
    box-shadow: none;
    transform: none;
}

@media (max-width: 480px) {
    body {
        padding: 10px 0;
        min-height: 100vh;
    }
    
    .container {
        padding: 15px;
        margin: 10px auto;
        max-width: calc(100vw - 20px);
        min-height: auto;
    }
    
    h1 {
        font-size: 2.5rem;
        margin-bottom: 15px;
    }
    
    .controls {
        flex-direction: column;
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .matrix-controls {
        display: none; /* Hide on mobile to prevent keyboard focus issues */
    }
    
    .control-group {
        justify-content: space-between;
    }
    
    .control-group label {
        min-width: 50px;
        font-size: 0.7rem;
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
    }
    
    .matrix-selector {
        font-size: 0.65rem;
        padding: 3px 6px;
        min-width: 70px;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        outline: none;
        background-clip: padding-box;
    }
    
    .toggle-btn {
        font-size: 0.8rem;
        padding: 6px 12px;
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        outline: none;
        -webkit-tap-highlight-color: transparent;
    }
    
    .tile {
        width: 55px;
        height: 55px;
        font-size: 1.8rem;
    }
    
    .key.letter {
        width: 40px;
        height: 55px;
        font-size: 1.1rem;
    }
    
    .key.wide {
        width: 65px;
        height: 55px;
        font-size: 0.8rem;
    }
    
    .modal-content {
        margin: 20% auto;
        padding: 25px;
    }
    
    .modal-content h2 {
        font-size: 1.8rem;
    }
    
    .modal-content p {
        font-size: 1.1rem;
    }
}

/* Additional mobile keyboard fix for very small screens */
@media (max-width: 600px) {
    .matrix-controls {
        display: none !important; /* Force hide to prevent any keyboard focus issues */
    }
    
    select, input, textarea, button:not(.key):not(.toggle-btn):not(#play-again-btn) {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
        outline: none;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
    }
    
    /* Ensure game keyboard works properly on mobile */
    .keyboard {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }
    
    .key {
        -webkit-tap-highlight-color: transparent;
        outline: none;
    }
}
