/* Medium CSS - Tablet/Medium Screen Responsive Styles */

/* Universal responsive design - adapts to any screen size */
@media (max-width: 900px), (max-height: 700px) {
    body {
        overflow-x: hidden;
        overflow-y: auto;
    }

    /* Compact layout for smaller screens (regardless of device) */
    #game-area {
        flex-direction: column;
        align-items: center;
        padding: 10px;
    }

    #game-content {
        flex-direction: column;
        align-items: center;
        gap: 15px;
        max-width: 100%;
    }

    #canvas-container {
        gap: 10px;
    }

    #game-canvas {
        width: auto;
        height: auto;
        max-width: 95vw;
        max-height: 60vh;
        border-radius: 8px;
    }

    #canvas-controls {
        width: 100%;
        max-width: 95vw;
        gap: 5px;
        justify-content: space-between;
    }

    .canvas-btn {
        flex: 1;
        padding: 10px 15px;
        font-size: 12px;
    }

    #game-controls {
        width: 95%;
        max-width: 850px;
        flex-direction: column;
        flex-wrap: wrap;
        gap: 15px;
        padding: 12px;
    }

    #tower-info {
        flex: 1;
        margin: 0;
    }

    /* Create a container for tower info and actions side by side */
    #tower-selection {
        flex: 1;
        width: 100%;
        min-width: 200px;
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    #tower-info-actions-container {
        display: flex;
        gap: 10px;
        align-items: flex-start;
    }

    #tower-actions {
        flex: 1;
        width: auto;
        min-width: 140px;
        flex-direction: column;
        gap: 10px;
    }

    #tower-actions button {
        padding: 8px 12px;
        font-size: 11px;
        min-height: 40px;
    }

    .tower-btn {
        flex: 1;  /* Distribute available space equally */
        flex-direction: column;
        padding: 10px 8px;
        font-size: 11px;
        max-width: 150px;
        min-height: 44px; /* Touch target minimum */
        align-items: center;
        text-align: center;
    }

    /* Ensure minimum touch target sizes for all interactive elements */
    .tower-btn,
    button,
    .header-btn {
        min-height: 44px;
        min-width: 44px;
    }

    /* Enhanced visual feedback for touch */
    .tower-btn:hover,
    .tower-btn:active {
        transform: translateY(-2px) scale(1.02);
        box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    }

    button:hover,
    button:active {
        transform: translateY(-1px);
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    }

    .header-btn:hover,
    .header-btn:active {
        transform: translateY(-1px) scale(1.02);
        box-shadow: 0 3px 10px rgba(0,0,0,0.2);
    }

    /* Better spacing for mobile fingers */
    .tower-grid {
        flex-direction: row;
        gap: 10px;
        display: flex;  /* Ensure it's flex */
        flex-wrap: wrap; /* Allow wrapping if needed */
    }

    .menu-buttons {
        gap: 12px;
    }


    /* Enhanced difficulty selection for touch */
    .difficulty-option {
        margin: 8px 0;
    }

    .difficulty-card {
        min-height: 60px;
        border-width: 3px;
        transition: all 0.2s ease;
    }

    .difficulty-option:hover .difficulty-card,
    .difficulty-option:active .difficulty-card {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    }

    /* Enhanced canvas cursor for touch devices */
    #game-canvas {
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    }

    #selected-tower-info {
        flex: 1;
        gap: 10px;
        }

    /* Improved readability on mobile */
    #selected-tower-info p,
    #tower-info p {
        margin: 6px 0;
        line-height: 1.4;
    }

    /* Better contrast and readability */
    .tower-name {
        font-weight: bold;
        color: #333;
    }

    .tower-cost {
        font-weight: bold;
        color: #B8860B;
        background: rgba(255,255,255,0.3);
        padding: 2px 4px;
        border-radius: 3px;
    }

    /* Enhanced hotkey visibility on mobile */
    .hotkey {
        background: linear-gradient(135deg, #8B4513, #A0522D);
        border-radius: 4px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.3);
        font-weight: bold;
    }
}