/* ========================================= */
/* === DESKTOP OPTIMIZATIONS START HERE === */
/* ========================================= */

/* === DESKTOP-SPECIFIC OVERRIDES === */
@media (pointer: fine) and (min-width: 1024px) {

    /* === MAIN GAME LAYOUT === */
    body {
        padding: 10px;
        overflow: hidden;
    }

    .game-wrapper {
        max-width: none;
        width: 100%;
        height: 100vh;
        gap: 10px;
        flex-direction: row;
        align-items: stretch;
    }

    /* === ENHANCED UI CONTAINER === */
    .ui-container {
        flex-direction: column;
        width: 320px;
        max-width: 320px;
        flex-shrink: 0;
        gap: 10px;
        height: 100%;
    }

    .stats-box,
    .log-box {
        width: 100%;
        max-height: none;
    }

    .stats-box {
        height: auto;
        flex-grow: 0;
    }

    .log-box {
        flex-grow: 1;
        min-height: 200px;
    }

    .actions-box {
        display: block;
        width: 100%;
        background-color: var(--dark-ui);
        border: 2px solid var(--grey-border);
        border-radius: 8px;
        padding: 10px;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    }

    .action-buttons-grid {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-top: 10px;
    }

    .action-btn-desktop {
        width: 100%;
        box-sizing: border-box;
        padding: 12px 10px;
        font-size: 0.9rem;
    }

    /* === LARGER GAME CANVAS === */
    #game-canvas {
        max-width: none;
        max-height: none;
        border-radius: 12px;
    }

    /* === HIDE MOBILE ELEMENTS === */
    .quick-actions,
    #mobile-dpad-container,
    #mobile-actions-container {
        display: none !important;
    }

    /* === ENHANCED DIALOGS === */
    .dialog-content {
        max-width: 90vw;
        max-height: 85vh;
        width: auto;
        overflow-y: auto;
        overflow-x: hidden !important;
        padding: 30px;
    }

    /* === CHARACTER SHEET OPTIMIZATIONS === */
    #character-sheet-screen .dialog-content {
        width: 95vw;
        max-width: 1200px;
        height: 85vh;
        max-height: 85vh;
        display: flex;
        flex-direction: row;
        gap: 30px;
        overflow-x: hidden !important;
        overflow-y: auto;
    }

    .character-sheet-panel {
        flex: 1;
        min-width: 0;
        max-width: 50%;
        overflow-y: auto;
        overflow-x: hidden !important;
        padding-right: 10px;
        box-sizing: border-box;
    }

    .character-sheet-panel:first-child {
        border-right: 2px solid var(--grey-border);
        padding-right: 20px;
    }

    /* === ACHIEVEMENTS GRID ENHANCEMENT === */
    .achievements-section {
        margin-top: 20px;
        padding-top: 20px;
        border-top: 2px solid #555;
        max-height: 400px;
        overflow-y: auto;
    }

    .achievements-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin-top: 15px;
    }

    .achievement-item {
        padding: 12px;
        font-size: 0.85rem;
    }

    .achievement-info strong {
        font-size: 0.8rem;
    }

    .achievement-info small {
        font-size: 0.65rem;
    }

    /* === INVENTORY OPTIMIZATIONS === */
    #inventory-list,
    #equipment-list {
        max-height: 300px;
        overflow-y: auto;
        padding-right: 10px;
    }

    /* === SETTINGS DIALOG === */
    #settings-screen .dialog-content {
        width: 600px;
        max-width: 90vw;
    }

    .settings-row {
        margin-bottom: 25px;
        font-size: 1rem;
    }

    .keybind-input {
        width: 150px;
        font-size: 1rem;
        padding: 8px;
    }

    /* === SHOP OPTIMIZATIONS === */
    #shop-screen .dialog-content {
        width: 90vw;
        max-width: 900px;
        height: 75vh;
        max-height: 75vh;
    }

    .shop-panels-container {
        display: flex;
        flex-direction: row;
        gap: 30px;
        height: 100%;
        overflow-x: hidden !important;
        overflow-y: auto;
    }

    .shop-panel {
        flex: 1;
        min-width: 0;
        max-width: 50%;
    }

    .shop-list {
        max-height: 400px;
    }

    /* === ENHANCED MESSAGE LOG === */
    #portrait-message-log {
        max-height: none;
        height: 100%;
        font-size: 0.85rem;
    }

    /* === FULL LOG SCREEN === */
    #full-log-screen .dialog-content {
        width: 90vw;
        max-width: 1000px;
        height: 80vh;
    }

    #full-log-content {
        font-size: 0.9rem;
        line-height: 1.4;
    }

    /* === GAME BUTTON ENHANCEMENTS === */
    .game-button {
        font-size: 1rem;
        padding: 15px 25px;
        transition: all 0.2s ease;
    }

    .game-button:hover:not(:disabled) {
        transform: translateY(-3px);
        box-shadow: 0 6px 20px rgba(255, 215, 0, 0.3);
    }

    /* === STATS DISPLAY IMPROVEMENTS === */
    .core-stats-grid {
        gap: 8px 15px;
        font-size: 1rem;
    }

    .stat-bar-line {
        margin-top: 8px;
    }

    .stat-bar-line p {
        font-size: 1rem;
    }

    /* === ENHANCED SCROLLBARS === */
    .character-sheet-panel::-webkit-scrollbar,
    .achievements-section::-webkit-scrollbar,
    #inventory-list::-webkit-scrollbar,
    #equipment-list::-webkit-scrollbar,
    .shop-list::-webkit-scrollbar,
    #full-log-content::-webkit-scrollbar {
        width: 8px;
    }

    .character-sheet-panel::-webkit-scrollbar-track,
    .achievements-section::-webkit-scrollbar-track,
    #inventory-list::-webkit-scrollbar-track,
    #equipment-list::-webkit-scrollbar-track,
    .shop-list::-webkit-scrollbar-track,
    #full-log-content::-webkit-scrollbar-track {
        background: #333;
        border-radius: 4px;
    }

    .character-sheet-panel::-webkit-scrollbar-thumb,
    .achievements-section::-webkit-scrollbar-thumb,
    #inventory-list::-webkit-scrollbar-thumb,
    #equipment-list::-webkit-scrollbar-thumb,
    .shop-list::-webkit-scrollbar-thumb,
    #full-log-content::-webkit-scrollbar-thumb {
        background: var(--main-gold);
        border-radius: 4px;
    }

    .character-sheet-panel::-webkit-scrollbar-thumb:hover,
    .achievements-section::-webkit-scrollbar-thumb:hover,
    #inventory-list::-webkit-scrollbar-thumb:hover,
    #equipment-list::-webkit-scrollbar-thumb:hover,
    .shop-list::-webkit-scrollbar-thumb:hover,
    #full-log-content::-webkit-scrollbar-thumb:hover {
        background: #ffed4e;
    }

    /* === ACHIEVEMENT POPUP POSITIONING === */
    .achievement-popup {
        top: 100px;
        right: -450px;
        max-width: 400px;
        font-size: 0.9rem;
    }

    .achievement-popup.show {
        right: 340px;
    }

    /* === TOAST POSITIONING === */
    .game-toast {
        top: 100px;
        font-size: 0.9rem;
        padding: 12px 24px;
    }

    /* === VERSION DISPLAY === */
    #version-display {
        font-size: 0.8rem;
        bottom: 30px;
        left: 30px;
    }

    /* === SETTINGS BUTTON === */
    #settings-button-container {
        top: 20px;
        right: 30px;
    }

    #open-settings-button {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }

    #open-settings-button:hover {
        background-color: rgba(255, 215, 0, 0.2);
        transform: scale(1.1);
    }
}

/* === ULTRA-WIDE SCREEN OPTIMIZATIONS === */
@media (pointer: fine) and (min-width: 1400px) {
    .ui-container {
        width: 380px;
        max-width: 380px;
    }

    #game-canvas {
        width: calc(100vw - 440px);
    }

    .achievement-popup.show {
        right: 400px;
    }
}

/* === HIGH-DPI SCREEN OPTIMIZATIONS === */
@media (pointer: fine) and (min-width: 1024px) and (-webkit-min-device-pixel-ratio: 2) {
    .core-stats-grid {
        font-size: 1.1rem;
    }

    .stat-bar-line p {
        font-size: 1.1rem;
    }

    h2 {
        font-size: 1.3rem;
    }

    .game-button {
        font-size: 1.1rem;
    }
}

/* Hide quick actions in landscape mode on mobile */
body.layout-landscape .quick-actions {
    display: none;
}

/* Multiplayer UI Styles */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
}

.lobby-player {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    margin: 5px 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    border: 2px solid #757575;
}

.lobby-player.ready {
    border-color: #4caf50;
}

#multiplayer-turn-indicator {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: #ffd700;
    padding: 10px 20px;
    border-radius: 20px;
    border: 2px solid #ffd700;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.8rem;
    z-index: 60;
    display: none;
}
