html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    width: 100%;
    max-width: 100%;
}

img, svg, video, canvas, iframe {
    max-width: 100%;
}

button, a, [role="button"], input, select, textarea {
    touch-action: manipulation;
}

@media (max-width: 768px) {
    html, body {
        min-width: 0;
        max-width: 100%;
        height: auto !important;
        max-height: none !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
    }

    body {
        min-height: 100vh;
        min-height: 100dvh;
    }

    .admin-layout {
        flex-direction: column;
        gap: 12px;
        padding: 12px;
    }

    .admin-layout > *,
    .content-area,
    .content-card,
    .main-container,
    .app-shell,
    .game-panel {
        min-width: 0;
        max-width: 100%;
    }

    .sidebar {
        width: 100%;
    }

    .sidebar .nav-list {
        flex-direction: row;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        scrollbar-width: thin;
    }

    .sidebar .nav-item-btn {
        width: max-content;
        min-height: 44px;
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .content-card {
        padding: 14px;
    }

    .app-shell {
        height: auto !important;
        min-height: 100dvh;
        max-height: none !important;
        overflow: visible !important;
    }

    .content-card-header {
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 10px;
    }

    .form-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .data-table-container {
        max-width: 100%;
        overscroll-behavior-inline: contain;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        min-width: 620px;
    }

    .game-selector-strip {
        overscroll-behavior-inline: contain;
        -webkit-overflow-scrolling: touch;
    }

    .navbar {
        position: relative;
        gap: 8px;
        padding: 10px;
    }

    .nav-controls {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .nav-controls > * {
        min-width: 0;
    }

    .profile-pill {
        grid-column: 1 / -1;
    }

    .nav-controls .btn-toy {
        min-height: 44px;
        padding: 8px;
        white-space: normal;
        text-align: center;
    }

    .hero-banner {
        padding: 18px 14px;
        gap: 16px;
    }

    .hero-stats {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .hero-stats > * {
        min-width: 0;
    }

    .games-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }

    .game-card {
        width: 100%;
        min-width: 0;
    }

    .modal, .modal-content, .modal-dialog {
        width: min(100% - 16px, 640px);
        max-width: 100%;
        max-height: calc(100dvh - 16px);
        overflow-y: auto;
    }

    .modal-overlay {
        align-items: flex-start;
        overflow-y: auto;
        padding: 8px;
    }

    .header-bar, .top-nav, header {
        flex-wrap: wrap;
        gap: 8px;
    }

    button, [role="button"], input[type="button"], input[type="submit"] {
        min-height: 44px;
    }

    input, select, textarea {
        min-width: 0;
        font-size: 16px;
    }
}

@media (max-width: 420px) {
    .admin-layout {
        padding: 8px;
    }

    .content-card {
        padding: 10px;
        border-radius: 14px;
    }

    .content-card-header h3 {
        font-size: 1rem;
    }

    .navbar .brand-text p {
        display: none;
    }

    .hero-stats {
        grid-template-columns: 1fr 1fr;
    }

    .actions, .card-actions {
        width: 100%;
    }

    .actions > button, .actions > a,
    .card-actions > button, .card-actions > a {
        flex: 1 1 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
