@media screen and (max-width: 900px) {

    html,
    body {
        touch-action: none;
        overscroll-behavior: none;
    }

    body {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        margin: 0;
        height: 100dvh;
        overflow: hidden;
        padding: 0 0 20px 0;
    }

    .all2 {
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
    }

    .up {
        margin: 16px 0 8px 0;
    }

    .titulo h1 {
        font-size: 2rem;
    }

    .titulo h1 a {
        color: inherit;
        text-decoration: none;
    }

    .titulo h1 a:visited {
        color: inherit;
    }

    .titulo h1 a:hover {
        color: inherit;
        text-decoration: none;
    }

    /* Línea decorativa bajo el título en móvil */
    .titulo-container {
        display: inline-block;
        position: relative;
    }

    .titulo-underline {
        width: 160px;
        height: 2px;
        background-color: #fff;
        margin: 6px auto 0;
        transform-origin: center;
        transform: scaleX(1);
        transition: transform 0.4s ease-in-out;
    }

    .titulo-container:hover .titulo-underline {
        transform: scaleX(0);
    }

    .dotcom {
        color: #c4c4c4;
        font-size: 1.4rem;
    }

    .titulo p {
        font-size: 1rem;
    }

    .todo {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        padding: 0 8px 0 0;
    }

    .all {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .games-section {
        width: 100%;
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .games-header {
        flex-shrink: 0;
    }

    .games-header h1 {
        font-size: 1.5rem;
    }

    .games-header p {
        font-size: 0.9rem;
    }

    .games-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-auto-rows: max-content;
        gap: 20px;
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        padding: 20px;
        align-content: start;
    }

    .game-header {
        gap: 2px;
        margin: 10px 0;
    }

    .game-icon {
        font-size: 1.6rem;
    }

    .game-title {
        font-size: 1rem;
    }

    .game-description {
        font-size: 0.85em;
    }

    .game-action-btn {
        width: 100px;
        height: 35px;
        font-size: 0.8em;
    }

    .no-games-message {
        padding: 40px 15px;
        font-size: 1.1em;
    }

    .no-games-message .icon {
        font-size: 3em;
    }

    .block-cube .bg-inner {
        left: 2px;
        top: 2px;
        right: 2px;
        bottom: 2px;
    }

    h1 {
        font-size: 20px;
    }

    .block-cube.block-input .text {
        padding: 20px 10px;
    }

    .game-card .text {
        height: auto !important;
        display: flex;
        flex-direction: column;
        justify-content: flex-start !important;
        min-height: auto;
    }

    .game-card {
        align-self: start;
        opacity: 1 !important;
        transform: none !important;
    }

    .pad18 {
        padding: 18px !important;
    }



    .upbar {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 20px;
    }

    .centro {
        width: 60%;
    }

    .izqder {
        width: 15%;
    }

    /* Estilos para los botones de navegación y tema en móvil */
    .nav-button,
    .theme-toggle {
        background: none;
        border: none;
        color: white;
        font-size: 1.2em;
        cursor: pointer;
        padding: 5px;
        border-radius: 4px;
        transition: all 0.3s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 100%;
    }

    .nav-button,
    .theme-toggle {
        width: 50px;
        height: 50px;
        object-fit: contain;
        transition: all 0.3s ease;
    }

    /* Modo claro */
    body.white {
        background-color: #eee;
        color: #212121;
    }

    body.white .titulo h1 a {
        color: #212121;
    }

    body.white .titulo-underline {
        background-color: #212121;
    }

    body.white .block-cube .bg-inner {
        background: #eee;
    }

    body.white .block-cube.block-input .bg-top,
    body.white .block-cube.block-input .bg-right,
    body.white .block-cube.block-input .bg {
        background: #212121;
    }

    body.white .play-btn.block-input .bg,
    body.white .play-btn.block-input .bg-top,
    body.white .play-btn.block-input .bg-right {
        background: #449944;
    }

    body.white .game-card:hover .play-btn.block-input .bg,
    body.white .game-card:hover .play-btn.block-input .bg-top,
    body.white .game-card:hover .play-btn.block-input .bg-right {
        background: #449944;
    }

    body.white .game-card .play-btn.block-input:hover .bg,
    body.white .game-card .play-btn.block-input:hover .bg-top,
    body.white .game-card .play-btn.block-input:hover .bg-right {
        background: #449944 !important;
    }


    body.white .games-header h1,
    body.white .game-title,
    body.white .block-cube.block-input .text {
        color: #212121;
    }

    body.white .dotcom {
        color: #636363;
    }

    body.white .nav-button,
    body.white .theme-toggle {
        filter: invert(0) brightness(0) contrast(1) saturate(1);
    }

    body.white .block-cube.block-input:hover .nav-button,
    body.white .block-cube.block-input:hover .theme-toggle {
        filter: invert(0);
    }
}