body {
    margin: 0;
    padding: 0;
    background-color: #1a1a1a;
    overflow: hidden;
    font-family: 'Cinzel', serif;
    color: #f0f0f0;
}
#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    background-color: #000;
}

#ui-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: grid;
    grid-template-areas:
        "character-status . minimap"
        "inventory-panel . ."
        "bottom-ui bottom-ui bottom-ui";
    grid-template-rows: 20% auto 20%;
    grid-template-columns: 35% auto 35%;
    padding: 10px;
    box-sizing: border-box;
}

/* --------------------
   Minimap
   -------------------- */
#minimap {
    grid-area: minimap;
    width: 120px;
    height: 120px;
    background-color: rgba(0, 0, 0, 0.7);
    border: 2px solid #a38b5d;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    pointer-events: auto;
    justify-self: end;
}

/* --------------------
   Charakter-Status
   -------------------- */
#character-status {
    grid-area: character-status;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.8);
    border: 2px solid #a38b5d;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    padding: 10px;
    pointer-events: auto;
    width: 250px;
}

/* NEUER Container für Porträt und Status */
#portrait-stats-container {
    display: flex;
    align-items: center; /* Zentriert die Elemente vertikal */
    gap: 10px; /* Fügt einen Abstand zwischen den Elementen hinzu */
    margin-bottom: 0px; /* Fügt Abstand zu den Statusbalken hinzu */
    width: 95%;
}

/* NEU: Stil für die Gruppe der Statuswerte */
.stats-group {
    display: flex;
    flex-direction: column;
    gap: 5px; /* Abstand zwischen ATT/DEF und den Balken */
    width: 60%;
}

/* NEU: Schriftgröße der Statusanzeigen anpassen */
.stat-display {
    font-size: 14px; /* HIER KÖNNEN SIE DIE SCHRIFTGRÖSSE ÄNDERN */
    white-space: nowrap; /* Verhindert, dass der Text umbricht */
}

#character-portrait {
    width: 80px;
    height: 80px;
    background-color: #333;
    border: 2px solid #a38b5d;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
    margin-bottom: 5px;
    background-size: cover;
    background-position: center;
}

.status-bar-container {
    width: 100%;
    height: 10px;
    background-color: rgba(50, 50, 50, 0.8);
    border: 1px solid #999;
    margin-top: 1px;
}

.status-bar {
    height: 100%;
    transition: width 0.3s ease-in-out;
}

.status-bar.hp {
    background: linear-gradient(90deg, #8b0000 0%, #dc3545 100%);
    box-shadow: 0 0 5px rgba(220, 53, 69, 0.8);
    width: 100%;

}

.status-bar.mp {
    background: linear-gradient(90deg, #00008b 0%, #007bff 100%);
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.8);
    width: 100%;
}


/* --------------------
   Inventar
   -------------------- */
#inventory-panel {
    grid-area: inventory-panel;
    background-color: rgba(0, 0, 0, 0.8);
    border: 2px solid #a38b5d;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    padding: 10px;
    pointer-events: auto;
    width: 250px;
    margin-top: 10px;
}

#inventory-panel h3 {
    text-align: center;
    margin: 0 0 10px 0;
    font-size: 16px;
    border-bottom: 1px solid #a38b5d;
    padding-bottom: 5px;
}

#equipped-items-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}

.equipped-slot {
    width: 48px;
    height: 48px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid #a38b5d;
    box-shadow: 0 0 5px rgba(163, 139, 93, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.equipped-icon {
    width: 32px;
    height: 32px;
    image-rendering: pixelated;
}

#inventory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    padding: 5px;
}

.inventory-slot {
    position: relative;
    width: 48px;
    height: 48px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(163, 139, 93, 0.5);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.inventory-slot:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: #f0f0f0;
}

.inventory-icon {
    width: 32px;
    height: 32px;
    image-rendering: pixelated;
    pointer-events: none;
}

.item-count {
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 10px;
    color: #fff;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 3px;
    padding: 1px 3px;
    pointer-events: none;
}

/* --------------------
   Bottom-UI (Buttons & Logs)
   -------------------- */
#bottom-ui {
    grid-area: bottom-ui;
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    background-color: rgba(0, 0, 0, 0.8);
    border: 2px solid #555;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.4);
    padding: 10px;
    pointer-events: auto;
}

#battle-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 5px;
}

.battle-button {
    background-color: #2c2c2c;
    color: #f0f0f0;
    border: 1px solid #777;
    border-radius: 4px;
    box-shadow: inset 0 0 5px rgba(255, 255, 255, 0.1);
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
    pointer-events: auto;
    white-space: nowrap;
}

.battle-button:hover {
    background-color: #444;
    border-color: #e0e0e0;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

#log-panel {
    display: flex;
    flex-direction: row;
    gap: 10px;
    width: 85%;
}

.log-area {
    background-color: rgba(10, 10, 10, 0.6);
    border: 1px solid #444;
    color: #ccc;
    border-radius: 4px;
    padding: 8px;
    flex: 1;
    overflow-y: auto;
    font-size: 12px;
}

#battle-log {
    flex: 1;
}

#event-log {
    flex: 1;
}

/* --------------------
   Touch-Steuerung
   -------------------- */
#touch-controls {
    position: fixed;
    bottom: 20vh;
    left: 0;
    right: 0;
    width: 100%;
    height: 120px;
    /* Standardmäßig auf dem Desktop ausgeblendet */
    display: none; 
    justify-content: center;
    align-items: center;
    gap: 30px;
    padding: 0 5%;
    touch-action: none;
    z-index: 100;
}

.joystick {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(150, 150, 150, 0.7) 0%, rgba(80, 80, 80, 0.7) 100%);
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 0, 0, 0.4);
}

.joystick-knob {
    position: absolute;
    width: 50px;
    height: 50px;
    background: radial-gradient(circle, #e0e0e0 0%, #b0b0b0 100%);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.6), inset 0 0 5px rgba(0, 0, 0, 0.4);
    border-radius: 50%;
    left: 25px;
    top: 25px;
}

.touch-button {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle, #ff5050 0%, #cc0000 100%);
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.6), inset 0 0 10px rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.touch-button svg {
    fill: white;
}

