/* ===== RESPONZIVNÍ STYLY ===== */

/* Desktop s menší obrazovkou — wrapper zabere vše */
@media (max-width: 1510px) {
    .wrapper {
        width: 100%;
        border-radius: 0;
        box-shadow: none;
    }
    body {
        align-items: flex-start;
    }
}

@media (max-width: 900px) {
    .header-right {
        gap: 6px;
    }
    .header-profile-link .header-username {
        display: none; /* Only show avatar circle on tablet */
    }
    .currency-display {
        min-width: 72px;
        padding: 4px 7px;
    }
    .currency-value { font-size: 1em; }
}

@media (max-width: 700px) {
    /* Disable fixed app box on small screens → native scroll */
    body { overflow-y: auto; overflow-x: hidden; }
    html { overflow-x: hidden; }
    .wrapper {
        width: 100%; height: auto;
        border-radius: 0; box-shadow: none;
        overflow: visible;
    }
    .content { max-height: none; overflow-y: auto; overflow-x: hidden; height: auto; }
    .main-container { min-height: calc(100vh - 54px - 48px); }

    .main-container { flex-direction: column; }
    .content { order: 1; padding: 6px 8px; }
    .mafia-menu {
        order: 2;
        width: 100%;
        max-height: 34vh;
        border-right: none;
        border-bottom: 2px solid;
    }
    .game-area { padding: 2px; }

    .settings-slide-panel, .slide-panel { width: 100%; right: -100%; }

    .footer-btn .btn-text { display: none; }
    .footer-btn .btn-icon { font-size: 22px; }
    .footer-btn { padding: 7px 12px; }
    .footer-copy { display: none; }
    .footer-copy-right { display: none; }
    .footer-panel-btns { justify-content: space-around; width: 100%; }

    .angel-panel {
        left: 50%; transform: translateX(-50%) translateY(-10px);
        width: 90%; max-width: 380px;
    }
    .angel-panel.visible { transform: translateX(-50%) translateY(0) !important; }
    .angel-checkboxes { grid-template-columns: repeat(2, 1fr); gap: 5px; }
    .effect-thumb { width: 25px; height: 25px; }
    .effect-name { font-size: 12px; }
}

@media (max-width: 480px) {
    .currency-icon { font-size: 1.1em; }
    .currency-value { font-size: 0.9em; }
    .currency-suffix { font-size: 0.85em; }
    .currency-display { min-width: 60px; padding: 3px 6px; }

    .image-container { width: 300px; height: 300px; }
    #gamblit-image { width: 260px; height: 260px; }
    #gamblit-message { font-size: 18px; padding: 10px 12px; }

    .angel-panel { width: 98%; padding: 10px; }
}

@media (max-width: 768px) {
    body.theme-cedule .wrapper { margin: 5px; border-width: 2px; }
    body.theme-cedule .currency-display { min-width: 60px; padding: 3px 5px; font-size: 12px; }
    body.theme-cedule .currency-value { font-size: 14px; }
    body.theme-cedule .mafia-menu li a { font-size: 16px; padding: 8px 10px; }
    body.theme-cedule .game-area { overflow-x: hidden; }
    body.theme-cedule .content { padding: 10px; }

}

/* ===== STICKY HEADER PRO MOBIL ===== */
@media (max-width: 700px) {
    body.sticky-header-active {
        padding-top: var(--header-height, 64px);
    }

    .mafia-header.sticky {
        padding: 6px 10px;
    }
}

@media (max-width: 480px) {
    body.sticky-header-active {
        padding-top: var(--header-height, 60px);
    }
}

/* ===== SKRYTÍ TLAČÍTEK NA MOBILU ===== */
@media (max-width: 700px) {
    .header-buttons {
        display: none;
    }
}

/* ===== NOVÉ POLOŽKY V MENU PRO MOBIL ===== */
.mobile-menu-tools {
    display: none;
}

@media (max-width: 700px) {
    .mobile-menu-tools {
        display: block;
        margin-top: 20px;
        border-top: 2px solid var(--border-color);
        padding-top: 15px;
    }
    
    .mobile-menu-tools .menu-section {
        color: #ffd700;
        font-size: 16px;
        margin-bottom: 10px;
    }
    
    .mobile-menu-tools .mobile-tool-btn {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 12px 15px;
        margin: 5px 0;
        background: linear-gradient(145deg, #3a2a1c, #1e140e);
        border: 2px solid var(--border-color);
        border-radius: 30px;
        color: var(--text-color);
        font-size: 18px;
        cursor: pointer;
        transition: all 0.2s ease;
        width: 100%;
        text-align: left;
        box-shadow: 0 3px 0 #0a0806;
    }
    
    .mobile-menu-tools .mobile-tool-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 5px 0 #0a0806;
        background: #5a4a3a;
        color: #ffd700;
        border-color: #ffd700;
    }
    
    .mobile-menu-tools .mobile-tool-btn .btn-icon {
        font-size: 24px;
        min-width: 30px;
    }
}

/* ===== TISK ===== */
@media print {
    .header-buttons,
    .mafia-menu,
    .btn-mafia,
    .angel-toggle-btn,
    .settings-slide-panel,
    .slide-panel {
        display: none !important;
    }
    
    .main-container {
        display: block;
    }
    
    .content {
        padding: 20px;
    }
}

/* ===== VYLEPŠENÍ MOBILU ===== */

/* Hry obecně - bez vodorovného přetékání */
@media (max-width: 700px) {
    .game-area, .content, .wrapper {
        overflow-x: hidden;
    }

    /* Bet input a tlačítka - větší plocha dotyku */
    .bet-input,
    input[type="number"],
    input[type="text"] {
        min-height: 44px;
        font-size: 16px; /* Prevents iOS zoom on focus */
    }

    .btn-mafia,
    button.btn-mafia {
        min-height: 48px;
        font-size: 16px;
    }

    /* Gamblit - přeskupení na mobilu */
    .gamblit-game .main-row {
        flex-direction: column;
        align-items: center;
    }

    .gamblit-game .left-panel {
        width: 100%;
        max-width: 380px;
    }

    .gamblit-game .right-panel {
        width: 100%;
        align-items: center;
    }

    .gamblit-game .image-container {
        width: 280px;
        height: 280px;
    }

    .gamblit-game #gamblit-image {
        width: 240px;
        height: 240px;
    }

    /* Karty (cups) - menší mezery */
    .cups-game {
        padding: 10px 5px;
    }

    /* Kufrovačka - mřížka */
    .suitcase-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 6px !important;
    }

    /* Vrátka - menší tiles */
    .door-container {
        gap: 8px;
    }

    /* Chestky - sloupec na mobilu */
    .chest-area {
        flex-direction: column;
        align-items: center;
    }

    /* Safe - stacked form */
    .safe-form {
        flex-direction: column;
    }

    /* Profile */
    .profile-stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    /* Hlavička - kompaktnější na malém */
    .mafia-header {
        padding: 6px 10px;
    }
    
    .currency-display {
        padding: 4px 6px;
        min-width: 65px;
    }

    /* Slide panely - plná šířka */
    .settings-slide-panel,
    .slide-panel {
        width: 100%;
    }
}

@media (max-width: 380px) {
    .currency-display {
        min-width: 55px;
        padding: 3px 5px;
    }

    .currency-icon { font-size: 1em; }
    .currency-value { font-size: 0.9em; }

    .gamblit-game .image-container {
        width: 240px;
        height: 240px;
    }

    .gamblit-game #gamblit-image {
        width: 200px;
        height: 200px;
    }
}

/* ===== GIFTS PAGE ===== */
@media (max-width: 700px) {
    .gifts-header { flex-direction: column; gap: 10px; text-align: center; }
    .gifts-page-title { font-size: 18px; }
    .gifts-streak-badge { font-size: 13px; }
    .gifts-streak-row { gap: 4px; }
    .streak-day { padding: 5px 6px; font-size: 10px; min-width: 36px; }
    .gift-card { padding: 14px 12px; }
}

/* ===== QUESTS PAGE ===== */
@media (max-width: 900px) {
    #quests-container { grid-template-columns: 1fr !important; }
}
@media (max-width: 700px) {
    .quest-filter-bar { gap: 6px; flex-wrap: wrap; }
    .q-filter-btn { font-size: 11px; padding: 5px 12px; }
    .quest-card { padding: 12px 14px 10px; }
    .quest-name { font-size: 13px; }
}

/* ===== BANK PAGE — KEY SHOP ===== */
@media (max-width: 700px) {
    .bank-panel { padding: 18px 14px; border-radius: 18px; }
    .bank-header h2 { font-size: 24px; letter-spacing: 2px; }
    .loan-buttons { grid-template-columns: repeat(2, 1fr); gap: 7px; }
    .loan-option { padding: 11px 5px; font-size: 14px; }
    .key-shop-grid { grid-template-columns: repeat(2, 1fr); gap: 7px; }
    .key-buy-btn { padding: 10px 6px; }
    .key-qty { font-size: 13px; }
    .key-price { font-size: 10px; }
}
@media (max-width: 400px) {
    .loan-buttons { grid-template-columns: repeat(2, 1fr); }
    .key-shop-grid { grid-template-columns: 1fr 1fr; }
}

/* ===== SLOT MACHINE ===== */
@media (max-width: 700px) {
    .slot-game,
    .slot-layout,
    .slot-machine,
    .slot-grid-wrap {
        max-width: 100%;
    }

    .slot-grid {
        min-width: 0;
    }
}

/* ===== SAFE PAGE ===== */
@media (max-width: 700px) {
    .safe-page-wrap { padding: 10px; }
    .safe-main { flex-direction: column; }
}

/* ===== PROFILE PAGE ===== */
@media (max-width: 700px) {
    .profile-stats-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 8px; }
    .profile-stat-card { padding: 12px 10px; }
    .profile-stat-value { font-size: 20px; }
}

/* ===== UNIFIED MOBILE GAME SHELL ===== */
@media (max-width: 700px) {
    .coin-game,
    .cups-game,
    .gamblit-game,
    .chest-game,
    .door-game,
    .basket-game,
    .suitcase-game,
    .plinko-game,
    .slot-game {
        padding: 6px !important;
    }

    .coin-game .game-layout,
    .cups-game .game-layout,
    .basket-game .game-layout,
    .suitcase-game .game-layout,
    .chest-game .game-layout,
    .door-game .game-layout,
    .plinko-layout,
    .slot-layout,
    .gamblit-game .main-row {
        gap: 10px !important;
    }

    .coin-game .left-panel,
    .coin-game .right-panel,
    .cups-game .left-panel,
    .cups-game .right-panel,
    .gamblit-game .left-panel,
    .gamblit-game .right-panel {
        width: 100% !important;
        max-width: 100% !important;
    }

    .coin-game .action-buttons,
    .cups-game .action-buttons,
    .suitcase-game .game-header,
    .slot-controls,
    .plinko-controls {
        margin-bottom: 0 !important;
    }

    .coin-game .flip-btn,
    .cups-game #cups-shuffle-btn,
    .suitcase-game .main-action-btn,
    .slot-spin-btn,
    .plinko #plinko-drop-btn,
    .plinko-game #plinko-drop-btn {
        min-height: 44px;
    }
}
