* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    min-height: 100dvh;
    padding: 1vh 2vw 0 2vw;
    margin: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.container {
    width: 95vw;
    height: 95vh;
    height: 95dvh;
    margin: 0 auto;
    background: white;
    border-radius: 1vh;
    padding: 1vh;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1vh;
}

.back-btn {
    padding: 1vh 2vw;
    background: #667eea;
    color: white !important;
    text-decoration: none;
    border-radius: 8px;
    font-size: 1.8vh;
    font-weight: bold;
    transition: all 0.3s;
    border: 2px solid #5568d3;
    display: inline-block;
}

.back-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.game-layout {
    display: grid;
    grid-template-columns: 1fr minmax(150px, 18vw) minmax(150px, 18vw);
    gap: 1.5vh;
    align-items: start;
    flex: 1;
    overflow: hidden;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 1vh;
    font-size: 2.5vh;
}

h2 {
    color: #555;
    margin-bottom: 1vh;
    font-size: 1.8vh;
}

/* Statistiken */
.stats {
    display: flex;
    justify-content: center;
    gap: 3vw;
    margin-bottom: 1.5vh;
    padding: 1vh;
    background: #f8f9fa;
    border-radius: 0.5vh;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.8vw;
}

.stat-label {
    font-weight: bold;
    color: #666;
    font-size: 1.6vh;
}

.stat-value {
    font-size: 2vh;
    font-weight: bold;
    color: #667eea;
}

/* Spielfeld */
.game-area {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 0;
    overflow: auto;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(14, 1fr);
    grid-template-rows: repeat(14, 1fr);
    gap: 0.1vh;
    background: #ddd;
    padding: 0.2vh;
    border-radius: 0.5vh;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
    width: min(65vh, 45vw);
    height: min(65vh, 45vw);
}

.grid-cell {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
}

.grid-cell.water {
    background: #4a90e2;
}

.grid-cell.sand {
    background: #f4d03f;
}

.grid-cell.longjump {
    background: #f39c12;
    position: relative;
}

.longjump-symbol {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3.5vh;
    z-index: 10;
    pointer-events: none;
}

.grid-cell.start {
    background: #e74c3c;
}

.grid-cell.goal {
    background: #2ecc71;
}

.player {
    position: absolute;
    width: 70%;
    height: 70%;
    background: white;
    border: 0.3vh solid black;
    border-radius: 50%;
    animation: pulse 1s ease-in-out infinite;
    transition: none;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.player-eyes {
    position: absolute;
    display: flex;
    gap: 15%;
}

.player-eye {
    width: 0.8vh;
    height: 0.8vh;
    aspect-ratio: 1;
    background: black;
    border-radius: 50%;
}

/* Augen-Positionen für verschiedene Richtungen */
.player[data-direction="0"] .player-eyes {
    top: 15%;
    left: 50%;
    transform: translateX(-50%);
}

.player[data-direction="1"] .player-eyes {
    right: 15%;
    top: 50%;
    transform: translateY(-50%);
    flex-direction: column;
}

.player[data-direction="2"] .player-eyes {
    bottom: 15%;
    left: 50%;
    transform: translateX(-50%);
}

.player[data-direction="3"] .player-eyes {
    left: 15%;
    top: 50%;
    transform: translateY(-50%);
    flex-direction: column;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Anweisungsbereich */
.controls-section {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    min-height: 0;
}

.command-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.command-btn {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5vw;
    padding: 1vh 1vw;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 0.5vh;
    font-size: 1.6vh;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 100%;
    touch-action: manipulation;
}

.command-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.command-btn:active {
    transform: translateY(0);
}

.command-btn .arrow {
    font-size: 2.2vh;
}

.command-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Queue */
.queue-section {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.command-queue {
    flex: 1;
    background: #f8f9fa;
    border: 0.2vh dashed #ccc;
    border-radius: 0.5vh;
    padding: 1vh;
    margin-bottom: 1vh;
    display: flex;
    flex-direction: column;
    gap: 0.8vh;
    align-items: stretch;
    overflow-y: auto;
    min-height: 0;
}

.command-queue.empty::before {
    content: 'Ziehe Befehle hierher...';
    color: #999;
    font-style: italic;
}

.command-queue.has-items::before {
    display: none;
}

.queue-item {
    background: white;
    border: 0.2vh solid #667eea;
    border-radius: 0.4vh;
    padding: 0.8vh 0.5vw;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5vw;
    width: 100%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.queue-item:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.queue-item.dragging {
    opacity: 0.5;
    cursor: move;
}

.queue-move-btn {
    background: transparent;
    border: none;
    cursor: grab;
    padding: 0.2vh 0.4vw;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
    flex-shrink: 0;
    opacity: 0.6;
}

.queue-move-btn img {
    width: 2.2vh;
    height: 2.2vh;
    display: block;
    pointer-events: none;
}

.queue-move-btn:hover {
    opacity: 1;
    transform: scale(1.15);
}

.queue-move-btn:active {
    cursor: grabbing;
    transform: scale(1.1);
}

.queue-item .arrow {
    font-size: 2.2vh;
    margin-left: 3vw;
}

.queue-item .label {
    font-size: 1.4vh;
    color: #666;
    flex: 1;
}

.queue-actions {
    display: flex;
    gap: 0.3vw;
    align-items: center;
    margin-left: auto;
}

.queue-delete-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 2vh;
    padding: 0.3vh 0.5vw;
    border-radius: 0.3vh;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    color: #e74c3c;
}

.queue-delete-btn:hover {
    background: #fde8e8;
    transform: scale(1.2);
}

.queue-delete-btn:active {
    background: #fbd5d5;
}

.queue-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
}

.start-btn, .clear-btn {
    width: 100%;
    padding: 1.2vh 1.5vw;
    font-size: 1.8vh;
    font-weight: bold;
    border: none;
    border-radius: 0.5vh;
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation;
}

.start-btn {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.start-btn:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    transform: none;
}

.clear-btn {
    background: #e74c3c;
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.clear-btn:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    max-width: 90vw;
    width: 350px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content h2 {
    color: #2ecc71;
    margin-bottom: 15px;
    font-size: 1.6em;
}

.modal-content p {
    color: #666;
    margin-bottom: 20px;
    font-size: 1em;
}

.next-level-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.next-level-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.retry-btn {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.retry-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}
/* User-ID-Anzeige */
.user-id-display {
    position: fixed;
    bottom: 1vh;
    right: 1vw;
    background: rgba(255, 255, 255, 0.9);
    padding: 0.5vh 1vw;
    border-radius: 5px;
    font-size: 1.2vh;
    color: #666;
    font-family: 'Courier New', monospace;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    cursor: help;
}

/* Rechtliche Links */
.legal-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 5px 0;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    z-index: 10000;
}
.legal-footer a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    margin: 0 12px;
}
.legal-footer a:hover {
    text-decoration: underline;
}