/* CSS Design System for Neon Cypher - Arcade Hub */

:root {
    --bg-dark: #0a0b0e;
    --card-bg: #12141a;
    --steel-grey: #262c38;
    --steel-grey-light: #384254;
    
    /* Neon Glow Coordinates */
    --cyber-cyan: #00ffcc;
    --neon-gold: #ffd700;
    --magenta-glow: #ff0055;
    
    --cyber-cyan-rgba: rgba(0, 255, 204, 0.45);
    --neon-gold-rgba: rgba(255, 215, 0, 0.45);
    
    /* Typography */
    --font-cyber: 'Share Tech Mono', monospace;
    --font-ui: 'Montserrat', sans-serif;
    
    --crt-brightness: 1.05;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

body.cyber-theme {
    background-color: var(--bg-dark);
    color: #e2e8f0;
    font-family: var(--font-ui);
    height: 100vh;
    height: 100dvh; /* dynamic viewport for mobile Safari browser */
    overflow: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* CRT Screen overlay effects */
.crt-scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        rgba(18, 16, 16, 0) 50%, 
        rgba(0, 0, 0, 0.25) 50%
    );
    background-size: 100% 4px;
    z-index: 1000;
    pointer-events: none;
}

.crt-vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.6);
    z-index: 1001;
    pointer-events: none;
}

/* Main Container Layout */
.game-root {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.game-container {
    width: 500px;
    max-width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px;
    position: relative;
    z-index: 10;
}

/* Header Integration Styles */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 2px solid var(--steel-grey);
    gap: 12px; /* Bulletproof flex gap prevents touching or overlapping under any scale */
}

.nav-back-btn {
    color: #e2e8f0;
    text-decoration: none;
    font-family: var(--font-cyber);
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color 0.2s, text-shadow 0.2s;
}

.nav-back-btn:hover {
    color: var(--cyber-cyan);
    text-shadow: 0 0 8px var(--cyber-cyan-rgba);
}

.main-title {
    font-family: var(--font-cyber);
    font-size: 1.55rem;
    font-weight: 900;
    letter-spacing: 1.5px;
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.glow-span {
    color: var(--cyber-cyan);
    text-shadow: 0 0 15px var(--cyber-cyan-rgba);
}

.header-right {
    display: flex;
    gap: 8px;
}

.header-icon-btn {
    background: var(--card-bg);
    border: 1px solid var(--steel-grey);
    color: #e2e8f0;
    border-radius: 6px;
    width: 34px;
    height: 34px;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: border-color 0.2s, box-shadow 0.2s;
    touch-action: manipulation;
}

.header-icon-btn:hover {
    border-color: var(--cyber-cyan);
    box-shadow: 0 0 8px var(--cyber-cyan-rgba);
}

/* Mode Switch CSS panels */
.mode-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 8px 0;
    background: #0f1218;
    border: 1px solid var(--steel-grey);
    padding: 6px 12px;
    border-radius: 8px;
}

.mode-badge {
    font-family: var(--font-cyber);
    font-size: 0.85rem;
    color: var(--cyber-cyan);
    text-shadow: 0 0 6px var(--cyber-cyan-rgba);
    font-weight: 700;
    letter-spacing: 1px;
}

.mode-toggles {
    display: flex;
    gap: 6px;
}

.mode-btn {
    background: transparent;
    border: 1px solid transparent;
    color: #64748b;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--font-ui);
    transition: all 0.2s;
    touch-action: manipulation;
}

.mode-btn.active {
    background: var(--steel-grey);
    color: #ffffff;
    border-color: var(--steel-grey-light);
}

/* Decryption Grid Elements */
.grid-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    padding: 10px 0;
}

.grid-row {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.grid-tile {
    width: 58px;
    height: 58px;
    border: 2px solid var(--steel-grey);
    background-color: var(--card-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: var(--font-cyber);
    font-size: 1.8rem;
    font-weight: 900;
    text-transform: uppercase;
    color: #ffffff;
    border-radius: 8px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.4);
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tile state micro animations */
.grid-tile.pop-in {
    animation: tilePop 0.1s ease-out;
}

@keyframes tilePop {
    0% { transform: scale(0.9); border-color: var(--steel-grey-light); }
    100% { transform: scale(1.0); }
}

.grid-tile.flipped {
    transform: rotateX(180deg);
}

/* Letter box color states after submit */
.grid-tile.correct {
    background-color: #052e25;
    border-color: var(--cyber-cyan);
    box-shadow: 0 0 12px var(--cyber-cyan-rgba);
    text-shadow: 0 0 6px var(--cyber-cyan);
}

.grid-tile.present {
    background-color: #383002;
    border-color: var(--neon-gold);
    box-shadow: 0 0 12px var(--neon-gold-rgba);
    text-shadow: 0 0 6px var(--neon-gold);
}

.grid-tile.absent {
    background-color: #1a1e26;
    border-color: var(--steel-grey);
    color: #475569;
}

/* Row errors (Shake) */
.grid-row.shake {
    animation: rowShake 0.4s ease-in-out;
}

@keyframes rowShake {
    0%, 100% { transform: translateX(0); }
    15%, 45%, 75% { transform: translateX(-8px); }
    30%, 60%, 90% { transform: translateX(8px); }
}

/* Bobbing success animations */
@keyframes tileBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-16px); }
}

/* Keyboard Panel Styling */
.keyboard-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 10px;
    border-top: 2px solid var(--steel-grey);
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 4px;
}

.key {
    background-color: #161a22;
    border: 1px solid var(--steel-grey);
    color: #cbd5e1;
    font-family: var(--font-cyber);
    font-size: 1rem;
    font-weight: 700;
    height: 48px;
    flex-grow: 1;
    max-width: 44px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.1s, border-color 0.1s, box-shadow 0.1s, transform 0.05s;
    touch-action: manipulation;
}

.key:active {
    transform: scale(0.92);
}

.double-width-key {
    max-width: 68px;
    font-size: 0.75rem;
}

/* Keyboard state coloring */
.key.correct {
    background-color: var(--cyber-cyan);
    border-color: var(--cyber-cyan);
    color: #000000;
    box-shadow: 0 0 10px var(--cyber-cyan-rgba);
}

.key.present {
    background-color: var(--neon-gold);
    border-color: var(--neon-gold);
    color: #000000;
    box-shadow: 0 0 10px var(--neon-gold-rgba);
}

.key.absent {
    background-color: #0b0e12;
    border-color: #1a222e;
    color: #475569;
}

/* Standard Modals configuration */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(6, 8, 12, 0.85);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 1;
    transition: opacity 0.3s ease;
    padding: 15px;
}

.modal-overlay.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background-color: #0e1218;
    border: 2px solid var(--steel-grey);
    border-radius: 12px;
    padding: 24px;
    width: 100%;
    max-width: 400px;
    position: relative;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
}

/* Glowing Border for Active 完成 stats */
.stats-content {
    border-color: var(--cyber-cyan);
    box-shadow: 0 0 25px rgba(0, 255, 204, 0.15);
}

.modal-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close-btn:hover {
    color: var(--magenta-glow);
}

.modal-title {
    font-family: var(--font-cyber);
    font-size: 1.4rem;
    font-weight: 900;
    letter-spacing: 1px;
    color: #ffffff;
    margin-bottom: 18px;
    text-align: center;
}

.modal-scroll-area {
    max-height: 320px;
    overflow-y: auto;
    padding-right: 6px;
}

/* Custom Scrollbar for Terminals */
.modal-scroll-area::-webkit-scrollbar {
    width: 4px;
}
.modal-scroll-area::-webkit-scrollbar-track {
    background: #0b0e12;
}
.modal-scroll-area::-webkit-scrollbar-thumb {
    background: var(--steel-grey);
    border-radius: 2px;
}

.modal-subtitle {
    font-family: var(--font-cyber);
    color: var(--cyber-cyan);
    font-size: 0.9rem;
    margin-top: 14px;
    margin-bottom: 8px;
    font-weight: 700;
}

.instruction-text {
    font-size: 0.85rem;
    line-height: 1.4;
    color: #cbd5e1;
    margin-bottom: 10px;
}

.example-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0;
}

.example-tile {
    width: 36px;
    height: 36px;
    border: 1px solid var(--steel-grey);
    background-color: var(--card-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: var(--font-cyber);
    font-weight: 900;
    font-size: 1.1rem;
    border-radius: 6px;
    color: #ffffff;
}

.example-desc {
    font-size: 0.75rem;
    color: #94a3b8;
    flex-grow: 1;
    line-height: 1.3;
}

.cyber-divider {
    height: 1px;
    background: linear-gradient(to right, transparent, var(--steel-grey) 20%, var(--steel-grey) 80%, transparent);
    margin: 18px 0;
}

.modal-btn {
    background: transparent;
    border: 1px solid var(--cyber-cyan);
    color: var(--cyber-cyan);
    font-family: var(--font-cyber);
    font-size: 1rem;
    font-weight: 700;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    margin-top: 14px;
    transition: all 0.2s;
    text-shadow: 0 0 6px var(--cyber-cyan-rgba);
    box-shadow: 0 0 8px rgba(0, 255, 204, 0.1);
    touch-action: manipulation;
}

.modal-btn:hover {
    background: var(--cyber-cyan);
    color: #000000;
    box-shadow: 0 0 15px var(--cyber-cyan-rgba);
}

/* Statistics Layouts */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 8px;
    text-align: center;
}

.stat-box {
    background: #0b0e12;
    border: 1px solid var(--steel-grey);
    padding: 8px 4px;
    border-radius: 8px;
}

.stat-val {
    font-family: var(--font-cyber);
    font-size: 1.4rem;
    font-weight: 900;
    color: #ffffff;
}

.stat-lbl {
    font-size: 0.6rem;
    text-transform: uppercase;
    color: #64748b;
    margin-top: 2px;
}

.distribution-title {
    font-family: var(--font-cyber);
    font-size: 0.95rem;
    color: var(--cyber-cyan);
    text-align: center;
    margin-bottom: 12px;
}

.distribution-chart {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chart-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.row-num {
    font-family: var(--font-cyber);
    font-size: 0.85rem;
    color: #64748b;
    width: 10px;
}

.chart-bar-container {
    flex-grow: 1;
    background-color: #0b0e12;
    height: 20px;
    border-radius: 4px;
    overflow: hidden;
}

.chart-bar {
    background-color: var(--steel-grey);
    height: 100%;
    color: #ffffff;
    font-family: var(--font-cyber);
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    transition: width 0.8s cubic-bezier(0.1, 0.8, 0.25, 1);
    min-width: 14px;
}

.chart-bar.active {
    background-color: var(--cyber-cyan);
    color: #000000;
    box-shadow: 0 0 8px var(--cyber-cyan-rgba);
}

.modal-footer-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.next-countdown-box {
    text-align: left;
}

.countdown-lbl {
    font-size: 0.6rem;
    color: #64748b;
    text-transform: uppercase;
}

.countdown-val {
    font-family: var(--font-cyber);
    font-size: 1.4rem;
    font-weight: 700;
    color: #ffffff;
}

.share-btn {
    background-color: var(--cyber-cyan);
    border: none;
    color: #000000;
    font-family: var(--font-cyber);
    font-weight: 900;
    font-size: 0.95rem;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 0 12px var(--cyber-cyan-rgba);
    transition: transform 0.2s, box-shadow 0.2s;
    touch-action: manipulation;
}

.share-btn:hover {
    box-shadow: 0 0 20px var(--cyber-cyan);
    transform: translateY(-2px);
}

.practice-action-box {
    width: 100%;
    display: flex;
    justify-content: center;
}

/* Action Toasts Overlay CSS */
.toast {
    position: fixed;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #ffffff;
    color: #000000;
    padding: 10px 20px;
    border-radius: 6px;
    font-family: var(--font-cyber);
    font-size: 0.9rem;
    font-weight: 900;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.25s ease;
}

.toast.hidden {
    opacity: 0;
    pointer-events: none;
}

/* AdSense pre-game compliance screen setup CSS */
.compliance-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #07090d;
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.compliance-overlay.hidden {
    display: none;
    pointer-events: none;
}

.compliance-box {
    background-color: #0e1218;
    border: 2px solid var(--magenta-glow);
    border-radius: 12px;
    width: 100%;
    max-width: 420px;
    padding: 28px;
    box-shadow: 0 0 35px rgba(255, 0, 85, 0.2);
    text-align: center;
}

.compliance-neon-tag {
    font-family: var(--font-cyber);
    font-size: 0.75rem;
    font-weight: 900;
    color: var(--magenta-glow);
    text-shadow: 0 0 8px rgba(255, 0, 85, 0.5);
    margin-bottom: 12px;
    letter-spacing: 1px;
}

.compliance-title {
    font-family: var(--font-cyber);
    font-size: 1.3rem;
    font-weight: 900;
    color: #ffffff;
    margin-bottom: 12px;
}

.compliance-desc {
    font-size: 0.8rem;
    color: #94a3b8;
    line-height: 1.4;
    margin-bottom: 20px;
}

.compliance-ad-placeholder {
    width: 100%;
    background-color: #0a0b0e;
    border: 1px dashed var(--steel-grey);
    border-radius: 6px;
    padding: 10px;
    min-height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 24px;
}

.compliance-btn {
    background: transparent;
    border: 1px solid var(--magenta-glow);
    color: var(--magenta-glow);
    font-family: var(--font-cyber);
    font-size: 0.95rem;
    font-weight: 700;
    padding: 10px 24px;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s;
    text-shadow: 0 0 6px rgba(255, 0, 85, 0.5);
    touch-action: manipulation;
}

.compliance-btn:hover {
    background-color: var(--magenta-glow);
    color: #ffffff;
    box-shadow: 0 0 15px rgba(255, 0, 85, 0.6);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: #090a0d;
}
::-webkit-scrollbar-thumb {
    background: var(--steel-grey);
    border-radius: 3px;
}

/* Start Menu Overlay Styling */
.start-menu-overlay {
    position: absolute;
    inset: 0;
    background-color: #07090d;
    z-index: 1900; /* High enough to cover game container elements */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
    transition: opacity 0.3s ease;
}

.start-menu-overlay.hidden {
    display: none !important;
    opacity: 0;
    pointer-events: none;
}

.start-menu-content {
    width: 100%;
    max-width: 380px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.start-menu-logo {
    margin-bottom: 15px;
}

.start-menu-title {
    font-family: var(--font-cyber);
    font-size: 2.2rem;
    font-weight: 900;
    color: #ffffff;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
    letter-spacing: 3px;
    margin-bottom: 6px;
}

.start-menu-subtitle {
    font-family: var(--font-cyber);
    font-size: 0.85rem;
    color: var(--cyber-cyan);
    text-shadow: 0 0 8px var(--cyber-cyan-rgba);
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: bold;
}

.start-menu-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.start-btn {
    background: #0f1218;
    border: 1px solid var(--steel-grey);
    color: #cbd5e1;
    font-family: var(--font-cyber);
    font-size: 1.05rem;
    font-weight: 700;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 1px;
    text-transform: uppercase;
    touch-action: manipulation;
}

.start-btn:hover {
    border-color: #ffffff;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

.start-btn.primary-btn {
    border-color: var(--cyber-cyan);
    color: var(--cyber-cyan);
    background: rgba(0, 255, 204, 0.03);
    text-shadow: 0 0 6px var(--cyber-cyan-rgba);
}

.start-btn.primary-btn:hover {
    background: var(--cyber-cyan);
    color: #000000;
    text-shadow: none;
    box-shadow: 0 0 20px var(--cyber-cyan);
    border-color: var(--cyber-cyan);
}

.start-btn:active {
    transform: scale(0.97);
}

/* Social Share Layout inside Completions Modal */
.share-box-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
}

.social-share-row {
    display: flex;
    gap: 6px;
}

.social-share-btn {
    background-color: #0b0e12;
    border: 1px solid var(--steel-grey);
    color: #cbd5e1;
    font-family: var(--font-cyber);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
    touch-action: manipulation;
    flex-grow: 1;
}

.whatsapp-share-btn:hover {
    border-color: #25d366;
    color: #25d366;
    box-shadow: 0 0 10px rgba(37, 211, 102, 0.3);
    background-color: rgba(37, 211, 102, 0.05);
}

.twitter-share-btn:hover {
    border-color: #ffffff;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
    background-color: rgba(255, 255, 255, 0.05);
}

/* Back Button Responsive Text Hides */
.back-text-short {
    display: none;
}


/* Mobile Portrait Sizing Constraints */
@media (max-width: 480px) {
    .game-container {
        padding: 5px;
    }
    
    .game-header {
        padding: 8px 0;
    }
    
    .nav-back-btn {
        font-size: 0.78rem;
    }
    
    .back-text-long {
        display: none !important;
    }
    
    .back-text-short {
        display: inline !important;
    }
    
    .main-title {
        font-size: 1.1rem;
        letter-spacing: 1px;
    }
    
    .header-right {
        gap: 5px;
    }
    
    .header-icon-btn {
        width: 30px;
        height: 30px;
        font-size: 0.95rem;
    }
    
    .grid-tile {
        width: 44px;
        height: 44px;
        font-size: 1.4rem;
        border-radius: 6px;
    }
    
    .key {
        height: 44px;
        font-size: 0.85rem;
        border-radius: 4px;
    }
    
    .double-width-key {
        max-width: 58px;
        font-size: 0.65rem;
    }
    
    .modal-content {
        padding: 16px;
    }
    
    .stat-val {
        font-size: 1.1rem;
    }
    
    .countdown-val {
        font-size: 1.1rem;
    }
    
    .share-btn {
        font-size: 0.8rem;
        padding: 8px 12px;
    }
}

/* Mobile Landscape Sizing Constraints */
@media (max-height: 580px) and (orientation: landscape) {
    body.cyber-theme {
        overflow-y: auto;
    }
    .game-container {
        height: auto;
        min-height: 100vh;
    }
}

/* Laptop and Short Screen Sizing Constraints (Responsive Vertical Heights) */
@media (max-height: 760px) {
    .game-container {
        padding: 5px;
    }
    .game-header {
        padding: 6px 0;
    }
    .main-title {
        font-size: 1.4rem;
    }
    .mode-panel {
        margin: 4px 0;
        padding: 4px 10px;
    }
    .mode-badge {
        font-size: 0.8rem;
    }
    .mode-btn {
        padding: 3px 8px;
        font-size: 0.7rem;
    }
    .grid-container {
        padding: 6px 0;
        gap: 5px;
    }
    .grid-row {
        gap: 5px;
    }
    .grid-tile {
        width: 48px;
        height: 48px;
        font-size: 1.5rem;
        border-radius: 6px;
    }
    .keyboard-container {
        padding-top: 8px;
        gap: 4px;
    }
    .keyboard-row {
        gap: 4px;
    }
    .key {
        height: 40px;
        font-size: 0.9rem;
        border-radius: 4px;
    }
    .double-width-key {
        max-width: 58px;
        font-size: 0.68rem;
    }
    /* Modal responsive updates to fit short displays */
    .modal-content {
        padding: 18px;
    }
    .modal-scroll-area {
        max-height: 240px;
    }
    .modal-title {
        font-size: 1.25rem;
        margin-bottom: 12px;
    }
    .cyber-divider {
        margin: 12px 0;
    }
}

@media (max-height: 660px) {
    .game-container {
        padding: 4px;
    }
    .game-header {
        padding: 4px 0;
    }
    .main-title {
        font-size: 1.25rem;
        letter-spacing: 1px;
    }
    .mode-panel {
        margin: 3px 0;
        padding: 3px 8px;
    }
    .mode-badge {
        font-size: 0.75rem;
    }
    .mode-btn {
        padding: 2px 6px;
        font-size: 0.68rem;
    }
    .grid-container {
        padding: 4px 0;
        gap: 4px;
    }
    .grid-row {
        gap: 4px;
    }
    .grid-tile {
        width: 42px;
        height: 42px;
        font-size: 1.35rem;
        border-radius: 5px;
    }
    .keyboard-container {
        padding-top: 4px;
        gap: 3px;
    }
    .keyboard-row {
        gap: 3px;
    }
    .key {
        height: 34px;
        font-size: 0.8rem;
    }
    .double-width-key {
        max-width: 52px;
        font-size: 0.65rem;
    }
    /* Modal responsive updates to fit very short displays */
    .modal-content {
        padding: 14px;
    }
    .modal-scroll-area {
        max-height: 180px;
    }
    .modal-title {
        font-size: 1.15rem;
        margin-bottom: 8px;
    }
    .cyber-divider {
        margin: 10px 0;
    }
}

@media (max-height: 560px) {
    .mode-panel {
        display: none; /* Hide mode switcher panel only under extreme heights to save space */
    }
    .grid-tile {
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
        border-radius: 4px;
    }
    .key {
        height: 28px;
        font-size: 0.75rem;
    }
    .double-width-key {
        max-width: 44px;
        font-size: 0.55rem;
    }
    .modal-scroll-area {
        max-height: 130px;
    }
}
