* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: sans-serif;
    background: linear-gradient(45deg, #87CEEB, #98FB98);
    min-height: 100vh;
    padding: 10px;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    /* Touch-optimiert */
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.game-container {
    max-width: 1200px;
    margin: 0 auto;
}

.header {
    text-align: center;
    margin-bottom: 20px;
    background: white;
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.header h1 {
    color: #2E7D32;
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.header p {
    font-size: 1.3em;
    color: #555;
    font-weight: bold;
}

.success-message {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #4CAF50;
    color: white;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    font-size: 1.3em;
    font-weight: bold;
    z-index: 1000;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    animation: bounce 0.5s ease-out;
    max-width: 350px;
}

.time-display {
    background: rgba(255,255,255,0.2);
    padding: 10px;
    border-radius: 10px;
    margin: 15px 0;
    font-size: 1.1em;
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate(-50%, -50%) translateY(0);
    }
    40%, 43% {
        transform: translate(-50%, -50%) translateY(-10px);
    }
    70% {
        transform: translate(-50%, -50%) translateY(-5px);
    }
    90% {
        transform: translate(-50%, -50%) translateY(-2px);
    }
}

.restart-btn {
    background: white;
    color: #4CAF50;
    border: none;
    padding: 12px 25px;
    border-radius: 15px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    margin: 8px 5px 0 5px;
    font-family: inherit;
    transition: all 0.2s ease;
}

.restart-btn:hover {
    background: #f0f0f0;
    transform: scale(1.05);
}

.restart-btn.secondary {
    background: transparent;
    border: 2px solid white;
    color: white;
}

.restart-btn.secondary:hover {
    background: rgba(255,255,255,0.1);
}

.game-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.dogs-area {
    background: rgba(255,255,255,0.9);
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    min-height: 280px;
}

.nests-area {
    background: rgba(255,255,255,0.9);
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.dog {
    width: 100px;
    height: 120px;
    margin: 8px;
    cursor: grab;
    position: relative;
    display: inline-block;
    transition: transform 0.2s ease;
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
    /* Touch-optimiert */
    touch-action: none;
    -webkit-user-drag: element;
}

.dog:active {
    cursor: grabbing;
    transform: scale(1.1);
}

.dog.dragging {
    opacity: 0.8;
    transform: rotate(3deg) scale(1.05);
    z-index: 100;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    transition: none;
}

/* Touch-spezifische Styles */
.dog.touch-active {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
    transition: all 0.15s ease;
}

/* Drop-Zone Highlighting */
.nest.valid-drop-zone .nest-inner {
    border-color: #4CAF50;
    border-style: solid;
    background-color: rgba(76, 175, 80, 0.2);
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.5);
}

.nest.invalid-drop-zone .nest-inner {
    border-color: #FF5722;
    border-style: solid;
    background-color: rgba(255, 87, 34, 0.2);
    animation: shake 0.5s ease-in-out;
}

.nest.drag-over .nest-inner {
    border-color: #2196F3;
    border-style: solid;
    background-color: rgba(33, 150, 243, 0.2);
    transform: scale(1.03);
}

/* Shake-Animation für falsche Drop-Zone */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
    20%, 40%, 60%, 80% { transform: translateX(2px); }
}

.paw-character {
    width: 80px;
    height: 80px;
    margin: 0 auto;
    position: relative;
    border-radius: 50%;
    background: linear-gradient(135deg, #f0f8ff, #e6f3ff);
    border: 2px solid #333;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.character-svg {
    width: 95px;
    height: 95px;
    filter: drop-shadow(1px 1px 2px rgba(0,0,0,0.2));
}

.nest {
    width: 140px;
    height: 140px;
    margin: 4px;
    display: inline-block;
    position: relative;
    transition: all 0.3s ease;
}

.nest.drag-over {
    transform: scale(1.1);
    filter: brightness(1.2);
}

.nest-inner {
    width: 120px;
    height: 120px;
    border-radius: 12px;
    border: 4px dashed #333;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 6px rgba(0,0,0,0.2);
}

.vehicle-svg {
    width: 100px;
    height: 100px;
    opacity: 0.8;
    filter: drop-shadow(1px 1px 2px rgba(0,0,0,0.3));
}

.nest.drag-over .vehicle-svg {
    opacity: 1;
    transform: scale(1.1);
}

.nest.occupied .vehicle-svg {
    opacity: 0.3;
}

.nest.occupied .nest-inner {
    border-style: solid;
    transform: scale(0.9);
}

/* Spezifische Charakterhintergründe */
.marshall {
    background: radial-gradient(circle, #FFE4E1, #FFB6C1);
    border-color: #FF0000;
}

.chase {
    background: radial-gradient(circle, #E6F3FF, #B0D4FF);
    border-color: #000080;
}

.rocky {
    background: radial-gradient(circle, #F0FFF0, #C1FFC1);
    border-color: #228B22;
}

.rubble {
    background: radial-gradient(circle, #FFFACD, #F0E68C);
    border-color: #FFD700;
}

.skye {
    background: radial-gradient(circle, #FFE4FF, #DDA0DD);
    border-color: #8B008B;
}

.zuma {
    background: radial-gradient(circle, #FFE4B5, #FFB347);
    border-color: #FF4500;
}

/* Nest-Farben */
.red {
    background: linear-gradient(135deg, #FFAAAA, #FF8888);
}

.blue {
    background: linear-gradient(135deg, #AACCFF, #88AAFF);
}

.green {
    background: linear-gradient(135deg, #AAFFAA, #88DD88);
}

.yellow {
    background: linear-gradient(135deg, #FFFFAA, #FFDD77);
}

.purple {
    background: linear-gradient(135deg, #FFAAFF, #EEAAEE);
}

.orange {
    background: linear-gradient(135deg, #FFDDAA, #FFCC88);
}

.progress {
    background: white;
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.progress-text {
    font-size: 1.1em;
    font-weight: bold;
    margin-bottom: 10px;
    color: #2E7D32;
}

.progress-bar {
    width: 100%;
    height: 15px;
    background: #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #81C784);
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 8px;
}

.game-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.time-counter {
    font-size: 1em;
    font-weight: bold;
    color: #2E7D32;
}

.highscore-btn {
    background: #FF9800;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: bold;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
}

.highscore-btn:hover {
    background: #F57C00;
    transform: scale(1.05);
}

/* Responsive Design - Touch-optimiert */
@media (max-width: 768px) {
    .game-area {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .header h1 {
        font-size: 1.8em;
    }
    
    .dogs-area {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: flex-start;
        min-height: 250px;
    }
    
    .dog {
        width: calc(33.333% - 4px);
        height: 110px;
        margin: 2px;
        display: block;
        flex-shrink: 0;
        /* Größere Touch-Targets */
        min-height: 44px;
        min-width: 44px;
    }
    
    .nest {
        width: calc(33.333% - 2px);
        height: 130px;
        margin: 1px;
        /* Größere Touch-Targets */
        min-height: 44px;
        min-width: 44px;
    }
    
    .nests-area {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: flex-start;
    }
    
    .paw-character {
        width: 70px;
        height: 70px;
    }
    
    .character-svg {
        width: 75px;
        height: 75px;
    }
    
    .nest-inner {
        width: 100px;
        height: 100px;
    }
    
    .vehicle-svg {
        width: 85px;
        height: 85px;
    }
    
    /* Touch-Feedback verstärken auf mobil */
    .dog.touch-active {
        transform: scale(1.2);
    }
}

/* Highscore System Styles */
.name-input-dialog {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.dialog-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    max-width: 300px;
}

.dialog-content h3 {
    color: #FF9800;
    margin-bottom: 15px;
    font-size: 1.4em;
}

.dialog-content p {
    color: #666;
    margin-bottom: 20px;
}

#playerName {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1.1em;
    text-align: center;
    margin-bottom: 20px;
    font-family: inherit;
    text-transform: uppercase;
}

#playerName:focus {
    outline: none;
    border-color: #4CAF50;
}

.dialog-buttons {
    display: flex;
    gap: 10px;
}

.save-btn, .skip-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
    font-family: inherit;
}

.save-btn {
    background: #4CAF50;
    color: white;
}

.skip-btn {
    background: #ddd;
    color: #666;
}

.highscore-panel {
    position: fixed;
    top: 20px;
    right: -350px;
    width: 320px;
    height: calc(100vh - 40px);
    background: white;
    border-radius: 15px;
    box-shadow: -5px 0 15px rgba(0,0,0,0.2);
    transition: right 0.3s ease;
    z-index: 1500;
    overflow: hidden;
}

.highscore-panel.show {
    right: 20px;
}

.panel-header {
    background: linear-gradient(135deg, #FF9800, #F57C00);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    margin: 0;
    font-size: 1.3em;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.8em;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    border-radius: 15px;
    transition: background 0.2s ease;
}

.close-btn:hover {
    background: rgba(255,255,255,0.2);
}

.highscore-list {
    padding: 20px;
    max-height: calc(100vh - 180px);
    overflow-y: auto;
}

.highscore-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    background: #f5f5f5;
    border-radius: 10px;
    transition: transform 0.2s ease;
}

.highscore-entry:hover {
    transform: scale(1.02);
}

.highscore-entry.highlight {
    background: linear-gradient(135deg, #FFD700, #FFA000);
    color: white;
    font-weight: bold;
}

.highscore-rank {
    font-weight: bold;
    color: #FF9800;
    width: 30px;
}

.highscore-name {
    flex: 1;
    text-align: left;
    margin-left: 10px;
}

.highscore-time {
    font-weight: bold;
    font-family: monospace;
}

.clear-btn {
    background: #f44336;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    margin: 20px;
    cursor: pointer;
    font-family: inherit;
}

.empty-highscore {
    text-align: center;
    color: #999;
    padding: 40px 20px;
    font-style: italic;
}
.success-animate {
    animation: success-pulse 0.6s ease-out;
}

@keyframes success-pulse {
    0% {
        transform: scale(1);
        filter: brightness(1);
    }
    50% {
        transform: scale(1.2);
        filter: brightness(1.3);
    }
    100% {
        transform: scale(1);
        filter: brightness(1);
    }
}