
/* ============================================
   MOBILE RESPONSIVENESS
   ============================================ */
@media (max-width: 600px) {
    #app {
        max-width: 100%;
    }

    .modal-content {
        max-width: 95%;
        max-height: 95%;
        padding: 16px;
    }

    .home-container {
        padding: 16px;
    }

    .logo h1 {
        font-size: 24px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .game-grid {
        grid-template-columns: 1fr;
    }

    .floating-points {
        top: 120px;
        left: 8px;
        right: auto;
        font-size: 12px;
        min-width: 120px;
        padding: 8px 12px;
    }

    .dice-area {
        flex-direction: column;
        gap: 24px;
    }

    .vs-divider {
        transform: rotate(90deg);
    }

    /* Chat fixes for mobile */
    .tab-content {
        overflow-y: hidden; /* Prevent double scrolling on mobile */
    }

    #chat-tab {
        height: 100%;
        overflow: hidden;
    }

    .chat-container {
        height: 100%;
        max-height: 100%;
        position: relative;
    }

    .chat-header {
        position: fixed;
        top: 50px; /* Below nav tabs */
        left: 0;
        right: 0;
        max-width: 600px;
        margin: 0 auto;
        padding: 12px;
        z-index: 95;
    }

    /* Matching tags pile on mobile - fixed below header */
    .matching-tags-pile {
        position: fixed;
        top: 150px; /* Below nav tabs (60px) + chat header (~90px, 2 rows) */
        left: 0;
        right: 0;
        max-width: 600px;
        margin: 0 auto;
        z-index: 94;
        padding: 8px 12px;
    }

    .matching-tags-pile .pile-tag {
        padding: 4px 10px;
        font-size: 12px;
    }

    .messages-container {
        padding: 12px;
        padding-top: 165px; /* Space for fixed 2-row header */
        padding-bottom: 80px; /* Space for fixed input */
        height: calc(100vh - 60px); /* Full height minus nav tabs */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Extra padding when tags pile is visible */
    .messages-container.tags-pile-visible {
        padding-top: 190px;
    }

    .chat-input-container {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-width: 600px;
        margin: 0 auto;
        padding: 12px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
        z-index: 95;
    }

    /* Fix typing indicator position on mobile */
    .typing-indicator {
        position: fixed;
        bottom: 68px; /* Position above the fixed input */
        left: 0;
        right: 0;
        max-width: 600px;
        margin: 0 auto;
        z-index: 94; /* Below input but above messages */
    }

    #message-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .message-bubble {
        max-width: 85%;
    }

    /* Session gallery modal — larger on mobile */
    .session-gallery-content {
        max-width: 98vw;
        width: 98vw;
        max-height: 95vh;
    }

    /* gallery-body needs position:relative for the absolutely-placed sheet */
    .gallery-body {
        position: relative;
    }

    /* Drawer handle becomes a horizontal tab at the bottom of the image area */
    .gallery-comment-handle {
        top: auto;
        right: 50%;
        bottom: 0;
        transform: translateX(50%);
        width: 72px;
        height: 26px;
        border-radius: 8px 8px 0 0;
        flex-direction: row;
        gap: 5px;
        box-shadow: 0 -3px 10px rgba(0, 0, 0, 0.2);
    }

    .gallery-comment-handle:hover {
        width: 80px;
        height: 30px;
    }

    /* Sheet handle: tap-to-close strip at the top of the bottom sheet */
    .gallery-comment-sheet-handle {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 28px;
        flex-shrink: 0;
        cursor: pointer;
    }

    .gallery-comment-sheet-handle::before {
        content: '';
        width: 40px;
        height: 4px;
        background: var(--border);
        border-radius: 2px;
    }

    /* Comment panel: bottom sheet sliding up over the image */
    .gallery-comment-panel {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100% !important;
        height: 0;
        border-left: none;
        border-top: 1px solid var(--border);
        transition: height 0.3s ease;
        z-index: 20;
    }

    .gallery-comment-panel.open {
        width: 100% !important;
        height: 60%;
    }
}


/* Mobile responsiveness for How To Play page */
@media (max-width: 768px) {
    #howtoplay-container {
        padding: 20px 15px;
    }

    #howtoplay-container .header h1 {
        font-size: 28px;
    }

    #howtoplay-container .header p {
        font-size: 16px;
    }

    .game-guide {
        padding: 20px;
    }

    .general-tips {
        padding: 20px;
    }

    .guide-nav ul {
        grid-template-columns: 1fr;
    }

    #howtoplay-container .footer-nav .btn {
        padding: 12px 30px;
        font-size: 16px;
    }
}
/* Responsive adjustments */
@media (max-width: 768px) {
    .liars-dice-container {
        padding: 8px;
        gap: 10px;
    }

    .dice-hand {
        gap: 6px;
        padding: 8px;
    }

    .die {
        font-size: 38px;
        width: 54px;
        height: 54px;
    }

    .die-back {
        font-size: 36px;
        width: 50px;
        height: 50px;
    }

    .bet-die {
        font-size: 30px;
        width: 46px;
        height: 46px;
    }

    .partner-dice-section,
    .my-dice-section-new {
        padding: 8px;
    }

    .game-controls-section {
        padding: 0;
        gap: 8px;
    }

    .section-header h3 {
        font-size: 13px;
    }

    .dice-count-badge {
        font-size: 13px;
        padding: 2px 8px;
    }

    .current-bet-compact {
        font-size: 17px;
        padding: 10px 14px;
        min-height: 44px;
    }

    .emote-btn-small {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }

    .emote-section-floating {
        right: 5px;
        gap: 4px;
    }

    .action-buttons-row .btn {
        padding: 12px 18px;
        font-size: 16px;
    }

    .overlay-indicator {
        font-size: 18px;
        padding: 12px 24px;
    }

    .overlay-emote {
        font-size: 50px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}