/* Game styling - simple and clean */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.game-container {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 1200px;
    width: 100%;
    position: relative;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
    font-size: 2em;
}

.deck-info {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.1em;
    color: #555;
}

/* Slots container */
.slots-container {
    display: flex;
    justify-content: space-around;
    gap: 15px;
    margin-bottom: 40px;
    min-height: 180px;
}

.slot {
    flex: 1;
    min-height: 180px;
    border: 3px dashed #ccc;
    border-radius: 8px;
    background: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    touch-action: none; /* Prevent scrolling while dragging */
}

.slot.drop-valid {
    border-color: #4caf50;
    background: #e8f5e9;
}

/* Player container */
.player-container {
    display: flex;
    justify-content: center;
    margin-bottom: 40px;
}

.player {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px 50px;
    border-radius: 10px;
    text-align: center;
    min-width: 200px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    touch-action: none; /* Prevent scrolling while dragging */
}

.player.drop-valid {
    box-shadow: 0 5px 25px rgba(76, 175, 80, 0.6);
    transform: scale(1.05);
}

.player-name {
    font-size: 1.8em;
    font-weight: bold;
    margin-bottom: 10px;
}

.player-hp {
    font-size: 1.3em;
}

.player-hp .low-hp {
    color: #ff6b6b;
    font-weight: bold;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Inventory container */
.inventory-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.hands-row {
    display: flex;
    justify-content: space-around;
    gap: 15px;
}

.bottom-row {
    display: flex;
    justify-content: space-around;
    gap: 15px;
}

.inventory-item {
    flex: 1;
    text-align: center;
}

.inventory-label {
    font-weight: bold;
    margin-bottom: 10px;
    color: #555;
    font-size: 1.1em;
}

.hand, .backpack, .treasure {
    min-height: 180px;
    border: 3px solid #ddd;
    border-radius: 8px;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-direction: column;
    touch-action: none; /* Prevent scrolling while dragging */
}

.hand.drop-valid, .backpack.drop-valid, .treasure.drop-valid {
    border-color: #4caf50;
    background: #e8f5e9;
}

.hand-disabled, .backpack-disabled {
    opacity: 0.5;
    background: #ccc !important;
    border-color: #999 !important;
    cursor: not-allowed;
    pointer-events: none;
}

.treasure {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    border-color: #d4af37;
    position: relative;
}

.treasure-score {
    font-weight: bold;
    font-size: 1.2em;
    color: #333;
    margin-top: 10px;
}

/* Cards */
.card {
    width: 140px;
    height: 180px;
    border: 2px solid #333;
    border-radius: 8px;
    background: white;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px;
    cursor: grab;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    touch-action: none; /* Prevent default touch behaviors like scrolling */
    -webkit-touch-callout: none; /* Disable iOS callout menu */
    user-select: none; /* Prevent text selection */
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.card:active {
    cursor: grabbing;
}

.card-monster {
    border-color: #d32f2f;
    background: linear-gradient(135deg, #ffcdd2 0%, #ef9a9a 100%);
}

.card-spell {
    border-color: #1976d2;
    background: linear-gradient(135deg, #bbdefb 0%, #90caf9 100%);
}

.card-shield {
    border-color: #388e3c;
    background: linear-gradient(135deg, #c8e6c9 0%, #a5d6a7 100%);
}

.card-potion {
    border-color: #f57c00;
    background: linear-gradient(135deg, #ffe0b2 0%, #ffcc80 100%);
}

.card-treasure {
    border-color: #d4af37;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
}

.card-type {
    font-weight: bold;
    font-size: 0.9em;
    text-align: center;
    color: #333;
}

.card-value {
    font-size: 1.2em;
    font-weight: bold;
    text-align: center;
    color: #333;
}

/* Game Over */
.game-over {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 40px 60px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    font-size: 2em;
    font-weight: bold;
    z-index: 1000;
    text-align: center;
}

.game-over.won {
    color: #4caf50;
    border: 3px solid #4caf50;
}

.game-over.lost {
    color: #d32f2f;
    border: 3px solid #d32f2f;
}

/* Difficulty Settings */
.difficulty-settings {
    background: #f5f5f5;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.difficulty-settings h2 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    font-size: 1.3em;
}

.slider-group {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.slider-group label {
    min-width: 120px;
    font-weight: bold;
    color: #555;
}

.slider {
    flex: 1;
    height: 8px;
    border-radius: 5px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    transition: background 0.3s;
}

.slider::-webkit-slider-thumb:hover {
    background: #764ba2;
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
    transition: background 0.3s;
}

.slider::-moz-range-thumb:hover {
    background: #764ba2;
}

.slider-total {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid #ddd;
    font-weight: bold;
    font-size: 1.1em;
    color: #333;
    text-align: center;
}

.new-game-btn {
    margin-top: 15px;
    padding: 12px 30px;
    font-size: 1.1em;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
}

.new-game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.new-game-btn:active {
    transform: translateY(0);
}

/* Responsive design for tablets and phones */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .game-container {
        padding: 15px;
    }
    
    h1 {
        font-size: 1.5em;
        margin-bottom: 15px;
    }
    
    .deck-info {
        font-size: 0.9em;
        margin-bottom: 15px;
    }
    
    /* Scale down cards */
    .card {
        width: 100px;
        height: 130px;
        padding: 8px;
    }
    
    .card-type {
        font-size: 0.75em;
    }
    
    .card-value {
        font-size: 1em;
    }
    
    /* Scale down slots */
    .slots-container {
        gap: 8px;
        margin-bottom: 20px;
        min-height: 140px;
    }
    
    .slot {
        min-height: 140px;
    }
    
    /* Scale down player */
    .player-container {
        margin-bottom: 20px;
    }
    
    .player {
        padding: 20px 30px;
        min-width: 150px;
    }
    
    .player-name {
        font-size: 1.3em;
    }
    
    .player-hp {
        font-size: 1em;
    }
    
    /* Scale down inventory */
    .inventory-container {
        gap: 10px;
    }
    
    .hands-row, .bottom-row {
        gap: 8px;
    }
    
    .hand, .backpack, .treasure {
        min-height: 140px;
    }
    
    .inventory-label {
        font-size: 0.9em;
        margin-bottom: 5px;
    }
    
    .treasure-score {
        font-size: 1em;
    }
    
    /* Scale down difficulty settings */
    .difficulty-settings {
        padding: 15px;
    }
    
    .difficulty-settings h2 {
        font-size: 1.1em;
    }
    
    .slider-group {
        margin-bottom: 10px;
        gap: 10px;
    }
    
    .slider-group label {
        min-width: 100px;
        font-size: 0.9em;
    }
    
    .game-over {
        padding: 30px 40px;
        font-size: 1.5em;
    }
}

/* Extra small phones */
@media (max-width: 480px) {
    body {
        padding: 5px;
    }
    
    .game-container {
        padding: 10px;
    }
    
    h1 {
        font-size: 1.2em;
        margin-bottom: 10px;
    }
    
    .deck-info {
        font-size: 0.8em;
        margin-bottom: 10px;
    }
    
    /* Even smaller cards */
    .card {
        width: 80px;
        height: 105px;
        padding: 6px;
    }
    
    .card-type {
        font-size: 0.65em;
    }
    
    .card-value {
        font-size: 0.85em;
    }
    
    /* Smaller slots */
    .slots-container {
        gap: 5px;
        margin-bottom: 15px;
        min-height: 115px;
    }
    
    .slot {
        min-height: 115px;
        border-width: 2px;
    }
    
    /* Smaller player */
    .player-container {
        margin-bottom: 15px;
    }
    
    .player {
        padding: 15px 20px;
        min-width: 120px;
    }
    
    .player-name {
        font-size: 1.1em;
    }
    
    .player-hp {
        font-size: 0.9em;
    }
    
    /* Smaller inventory */
    .inventory-container {
        gap: 8px;
    }
    
    .hands-row, .bottom-row {
        gap: 5px;
    }
    
    .hand, .backpack, .treasure {
        min-height: 115px;
        border-width: 2px;
    }
    
    .inventory-label {
        font-size: 0.8em;
        margin-bottom: 4px;
    }
    
    .treasure-score {
        font-size: 0.9em;
    }
    
    /* Smaller difficulty settings */
    .difficulty-settings {
        padding: 10px;
    }
    
    .difficulty-settings h2 {
        font-size: 1em;
        margin-bottom: 10px;
    }
    
    .slider-group {
        margin-bottom: 8px;
        gap: 8px;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .slider-group label {
        min-width: auto;
        font-size: 0.85em;
    }
    
    .slider {
        width: 100%;
    }
    
    .game-over {
        padding: 20px 30px;
        font-size: 1.2em;
    }
}

