/* Global Styles */
:root {
    --ui-scale: 1; /* Remove scaling constraints for full width usage */
}

body {
    font-family: 'Georgia', serif;
    background: url('hintergrund.webp') no-repeat center center fixed;
    background-size: cover;
    color: #f0f0f0;
    margin: 0;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    min-height: 100vh;
    text-align: center;
    width: 100vw;
    overflow-x: auto;
}

#hud-root {
    position: relative;
    width: 100vw;
    min-height: 100vh;
    /* Remove transform scaling to use full viewport */
}

/* Combat screen overrides the scaling to use full viewport */
#combat-screen #hud-root,
.screen#combat-screen {
    transform: none;
    width: 100vw;
    height: 100vh;
}

/* Header and Footer */
header {
    background-color: rgba(0, 0, 0, 0.8);
    padding: 0 20px 0 20px;
    margin-bottom: 10px;
    color: #f5d742;
    width: 100%;
    box-sizing: border-box;
}

header table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

footer {
    background-color: rgba(0, 0, 0, 0.8);
    padding: 10px 0;
    color: #f5d742;
    width: 100%;
    box-sizing: border-box;
}

header h1 {
    margin: 0;
    font-size: 24px;
}

footer p {
    margin: 0;
    font-size: 14px;
}

/* Screen Styles - Updated to match Combat UI aesthetic */
.screen {
    padding: 20px;
    width: 100%;
    margin: 0 auto;
    background: linear-gradient(135deg, rgba(40, 35, 30, 0.9), rgba(50, 45, 40, 0.9));
    border: 2px solid #8B4513;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    box-sizing: border-box;
}

/* Combat screen uses full viewport */
#combat-screen.screen {
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
    border-radius: 0;
    max-width: none;
}

.hidden {
    display: none !important;
}

/* Charaktererstellung Styles */
.character-creation-container {
    display: flex;
    flex-direction: column;
    text-align:center;
    gap: 20px;
}

.character-creation-container label {
    font-weight: bold;
    font-size: 18px;
}

.character-creation-container input,
.character-creation-container select {
    font-size: 16px;
    padding: 8px;
    width: min(60%, 400px);
    background-color: #333;
    color: #f0f0f0;
    border: 1px solid #666;
    border-radius: 4px;
    box-sizing: border-box;
}

.character-creation-container input::placeholder {
    color: #aaa;
}

.disabled-button {
    background-color: #888;  /* Graue Hintergrundfarbe */
    color: #ccc;             /* Graue Textfarbe */
    cursor: not-allowed;     /* Zeigt an, dass der Button nicht klickbar ist */
    opacity: 0.6;            /* Leicht transparent */
}

.game-button {
    padding: 10px 20px;
    background-color: #333;
    color: #f0f0f0;
    border: none;
    font-size: 18px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.game-button:hover {
    background-color: #555;
}


#race-info, #class-info {
    margin-top: 10px;
    font-size: 14px;
    color: #d9d9d9;
}

/* Attribut-Tabelle Styles */
.attribute-table {
    margin: 20px 0;
}

.attribute-table table {
    width: 100%;
    border-collapse: collapse;
    background-color: #444;
    border: 1px solid #666;
}

.attribute-table th, .attribute-table td {
    padding: 10px;
    border: 1px solid #666;
    text-align: left;
    font-size: 16px;
}

.attribute-table th {
    background-color: #333;
    color: #f5d742;
}

#start-game {
    padding: 10px 20px;
    background-color: #333;
    color: #f0f0f0;
    border: none;
    font-size: 18px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
}

#start-game:hover {
    background-color: #555;
}

/* Spielwelt und Charakterstatus */
#game-container {
    display: grid;
    grid-template-columns: 320px 1fr 280px;
    grid-template-rows: 1fr;
    gap: 20px;
    width: 100%;
    height: calc(100vh - 120px); /* Account for header and footer */
    box-sizing: border-box;
    padding: 10px;
    min-width: 1200px; /* Ensure minimum width for layout */
    position: relative;
}

/* Game Panels */
.game-panel {
    display: flex;
    flex-direction: column;
    min-height: 0; /* Allow panels to shrink */
    box-sizing: border-box;
}

/* Left Panel - Character Status */
#left-panel {
    grid-column: 1;
    grid-row: 1;
    overflow-y: auto;
    max-height: 100%;
}

/* Center Panel - Map Area */
#center-panel {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 0;
    position: relative;
    /* Visual styling to show this is the map area */
    background: linear-gradient(135deg, rgba(20, 20, 20, 0.2), rgba(35, 35, 35, 0.2));
    border: 2px solid rgba(245, 215, 66, 0.3);
    border-radius: 12px;
    padding: 10px;
}

/* Right Panel - Game Menu */
#right-panel {
    grid-column: 3;
    grid-row: 1;
    overflow-y: auto;
    max-height: 100%;
}

/* Position the original containers in the center area using CSS Grid positioning */
#map-container,
#dungeon-container,
#city-container {
    grid-column: 2;
    grid-row: 1;
    position: relative;
    width: 100%;
    height: 100%;
    margin: clamp(8px, 2vw, 20px);
    --grid-padding: clamp(8px, 1.5vw, 16px);
    padding: var(--grid-padding);
    box-sizing: border-box;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 0;
    --grid-size: 15;
    --grid-rows: 15;
    --grid-cell-size: 48px;
    --grid-gap: 0px;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.35));
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
}

/* Responsive scaling for smaller screens */
@media (max-width: 1400px) {
    #game-container {
        grid-template-columns: 280px 1fr 250px;
        gap: 15px;
    }
}

@media (max-width: 1200px) {
    #game-container {
        grid-template-columns: 260px 1fr 220px;
        gap: 10px;
        min-width: 900px;
    }
}

/* Character Status Panel */
#character-status {
    background: linear-gradient(135deg, rgba(40, 35, 30, 0.9), rgba(50, 45, 40, 0.9));
    border: 2px solid #8B4513;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    color: #f0f0f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    height: 100%;
    overflow-y: auto;
}

.character-info-section {
    margin-bottom: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 8px;
    border: 1px solid rgba(139, 69, 19, 0.3);
}

.character-info-section h4 {
    color: #D2B48C;
    font-size: 13px;
    font-weight: bold;
    margin: 0 0 8px 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    border-bottom: 1px solid rgba(139, 69, 19, 0.4);
    padding-bottom: 4px;
}

/* Game Menu Panel */
#game-menu {
    background: linear-gradient(135deg, rgba(40, 35, 30, 0.9), rgba(50, 45, 40, 0.9));
    border: 2px solid #8B4513;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    color: #f0f0f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    height: 100%;
    overflow-y: auto;
}

#game-menu h3 {
    color: #f5d742;
    font-size: 16px;
    font-weight: bold;
    margin: 0 0 15px 0;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    border-bottom: 2px solid #8B4513;
    padding-bottom: 8px;
}

.menu-section {
    margin-bottom: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 10px;
    border: 1px solid rgba(139, 69, 19, 0.3);
}

.menu-section h4 {
    color: #D2B48C;
    font-size: 13px;
    font-weight: bold;
    margin: 0 0 10px 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    border-bottom: 1px solid rgba(139, 69, 19, 0.4);
    padding-bottom: 4px;
}

.menu-button {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, rgba(60, 50, 40, 0.8), rgba(70, 60, 50, 0.8));
    color: #f0f0f0;
    border: 1px solid #8B4513;
    font-size: 13px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    box-sizing: border-box;
}

.menu-button:hover {
    background: linear-gradient(135deg, rgba(80, 65, 50, 0.9), rgba(90, 75, 60, 0.9));
    border-color: #f5d742;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transform: translateY(-1px);
}

.menu-button:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.menu-icon {
    margin-right: 8px;
    font-size: 16px;
    min-width: 20px;
    text-align: center;
}

.menu-text {
    flex: 1;
    text-align: left;
}

#map-grid {
    --grid-size: 15;
    --grid-cell-size: clamp(24px, 4vw, 60px);
    display: grid;
    grid-template-columns: repeat(var(--grid-size), minmax(0, var(--grid-cell-size)));
    grid-template-rows: repeat(var(--grid-size), minmax(0, var(--grid-cell-size)));
    gap: 0px;
    margin: 10px auto;
    background-color: rgba(0,0,0,0.5);
    padding: clamp(8px, 1.5vw, 16px);
    border-radius: 8px;
    box-sizing: border-box;
}

#map-grid div {
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(12px, 1.2vw, 18px);
    border-radius: 4px;
}

.enemy-cell {
    background-color: darkred;
    color: #fff;
}

.fog {
    background-color: #333;
}

#character-status h3 {
    color: #f5d742;
    font-size: 16px;
    font-weight: bold;
    margin: 0 0 15px 0;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    border-bottom: 2px solid #8B4513;
    padding-bottom: 8px;
}



#character-status table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    padding: 8px;
    border: 1px solid rgba(139, 69, 19, 0.5);
}

#character-status td {
    padding: 8px;
    border: 1px solid rgba(139, 69, 19, 0.3);
    text-align: left;
    background: rgba(0, 0, 0, 0.2);
}

#character-status td:first-child {
    color: #D2B48C;
    font-weight: bold;
}

/* Kampf-Bildschirm Styles */
#combat-screen {
    background: linear-gradient(135deg, rgba(30, 25, 20, 0.95), rgba(45, 35, 25, 0.95));
    padding: 15px;
    margin: 0;
    width: 100vw;
    min-height: 100vh;
    box-sizing: border-box;
    overflow: hidden;
}

/* Reference Sheet Layout */
#combat-reference-layout {
    display: grid;
    grid-template-columns: 320px 1fr 320px;
    gap: 20px;
    height: 100vh;
    width: 100vw;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
    min-width: 1200px; /* Ensure minimum width for layout */
}

/* Combat Reference Panels */
.combat-reference-panel {
    background: linear-gradient(135deg, rgba(40, 35, 30, 0.9), rgba(50, 45, 40, 0.9));
    border: 2px solid #8B4513;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    overflow-y: auto;
    backdrop-filter: blur(3px);
    max-height: 100%;
}

/* Center Combat Area */
.combat-reference-center {
    background: linear-gradient(135deg, rgba(20, 20, 20, 0.8), rgba(35, 35, 35, 0.8));
    border: 3px solid #f5d742;
    border-radius: 12px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    min-height: 0;
    overflow: hidden;
}

/* Reference Section Styling */
.reference-section {
    margin-bottom: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    padding: 8px;
    border: 1px solid rgba(139, 69, 19, 0.5);
}

.reference-title {
    color: #f5d742;
    font-size: 16px;
    font-weight: bold;
    margin: 0 0 10px 0;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    border-bottom: 2px solid #8B4513;
    padding-bottom: 8px;
}

.reference-subtitle {
    color: #D2B48C;
    font-size: 14px;
    font-weight: bold;
    margin: 0 0 8px 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    border-bottom: 1px solid rgba(139, 69, 19, 0.4);
    padding-bottom: 4px;
}

/* Initiative Display */
.turn-order-info {
    font-size: 13px;
}

.initiative-list {
    margin-bottom: 8px;
}

.initiative-entry {
    display: flex;
    justify-content: space-between;
    padding: 4px 8px;
    margin: 2px 0;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 4px;
    border: 1px solid transparent;
}

.initiative-entry.current-turn {
    background: rgba(245, 215, 66, 0.2);
    border-color: #f5d742;
    font-weight: bold;
}

.initiative-name {
    color: #f0f0f0;
}

.initiative-value {
    color: #f5d742;
    font-weight: bold;
}

.round-info {
    text-align: center;
    color: #D2B48C;
    font-weight: bold;
    background: rgba(0, 0, 0, 0.5);
    padding: 4px;
    border-radius: 4px;
}

/* Compact Status */
.compact-status {
    font-size: 12px;
}

.status-entry {
    margin: 4px 0;
    padding: 4px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 3px;
    color: #f0f0f0;
}

.status-entry strong {
    color: #f5d742;
}

/* Reference Buttons */
.reference-button {
    padding: 4px 8px;
    margin: 1px;
    border: none;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    min-height: 28px;
    display: inline-block;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
}

.reference-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* Button Categories */
.reference-button.attack {
    background: linear-gradient(135deg, #DC143C, #8B0000);
    color: white;
}

.reference-button.defense {
    background: linear-gradient(135deg, #4682B4, #1E90FF);
    color: white;
}

.reference-button.support {
    background: linear-gradient(135deg, #9370DB, #6A5ACD);
    color: white;
}

.reference-button.stealth {
    background: linear-gradient(135deg, #2F4F4F, #708090);
    color: white;
}

.reference-button.tactical {
    background: linear-gradient(135deg, #DAA520, #B8860B);
    color: white;
}

.reference-button.utility {
    background: linear-gradient(135deg, #696969, #A9A9A9);
    color: white;
}

.reference-button.special {
    background: linear-gradient(135deg, #800080, #9932CC);
    color: white;
}

.reference-button.bonus {
    background: linear-gradient(135deg, #32CD32, #228B22);
    color: white;
}

.reference-button.primary {
    background: linear-gradient(135deg, #FF8C00, #FF6347);
    color: white;
}

.reference-button.danger {
    background: linear-gradient(135deg, #8B0000, #DC143C);
    color: white;
}

.reference-button.movement-btn {
    background: linear-gradient(135deg, #4682B4, #1E90FF);
    color: white;
}

.reference-button.spell {
    background: linear-gradient(135deg, #9932CC, #8B008B);
    color: white;
}

/* Action Grids */
.action-grid-compact {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    margin-top: 4px;
}

.movement-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: #f0f0f0;
}

/* Combat Log in Left Panel */
.combat-log-left {
    background-color: rgba(20, 20, 20, 0.8);
    border: 1px solid #8B4513;
    padding: 8px;
    height: 150px;
    overflow-y: auto;
    font-size: 11px;
    color: #f0f0f0;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
}

.combat-log-left p {
    margin: 2px 0;
    padding: 2px 4px;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 2px;
    line-height: 1.3;
}

.combat-log-left .log-player {
    color: #4CAF50;
}

.combat-log-left .log-enemy {
    color: #F44336;
}

.combat-log-left .log-system {
    color: #FFC107;
}

/* Reaction Status */
.reaction-status {
    font-size: 12px;
    color: #f0f0f0;
}

/* Combat Area Grid */
#combat-area {
    position: relative;
    width: 100%;
    height: 100%;
    margin: 0 auto;
    border: 3px solid #8B4513;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(34, 40, 34, 0.8), rgba(45, 50, 45, 0.8));
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.8);
    overflow: hidden;
    aspect-ratio: 1;
    min-width: 500px; /* Ensure minimum size */
    min-height: 500px;
}

/* Grid with coordinates */
#grid-layer {
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(139, 69, 19, 0.3) 1px, transparent 1px),
        linear-gradient(90deg, rgba(139, 69, 19, 0.3) 1px, transparent 1px);
    background-size: calc(100% / 15) calc(100% / 15);
    z-index: 10;
    pointer-events: none;
    position: relative;
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    grid-template-rows: repeat(15, 1fr);
}

.grid-cell {
    border: 1px solid rgba(139, 69, 19, 0.3);
    position: relative;
    background: rgba(85, 107, 47, 0.1);
}

.grid-cell::before {
    content: attr(data-coord);
    position: absolute;
    top: 2px;
    left: 2px;
    font-size: 8px;
    color: #D2B48C;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    z-index: 100;
}

.grid-cell:nth-child(odd) {
    background: rgba(85, 107, 47, 0.05);
}

.grid-cell:nth-child(even) {
    background: rgba(85, 107, 47, 0.15);
}

#terrain-layer,
#token-layer {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 20;
}

#combat-log {
    background-color: #444;
    padding: 10px;
    height: 200px;
    overflow-y: auto;
    font-size: 16px;
    color: #f0f0f0;
    margin-bottom: 20px;
    border-radius: 8px;
}

#turn-order {
    background-color: #333;
    padding: 5px;
    color: #f0f0f0;
    font-size: 14px;
    border-radius: 8px;
    margin-bottom: 10px;
    text-align: center;
}

#action-status {
    background-color: #222;
    padding: 5px;
    color: #f0f0f0;
    font-size: 14px;
    border-radius: 8px;
    margin-bottom: 10px;
    text-align: center;
}

#combat-log p {
    margin: 5px 0;
    padding: 5px;
    background-color: #555;
    border-radius: 5px;
    font-family: 'Courier New', Courier, monospace;
}

#combat-layout {
    display: grid;
    grid-template-columns: 250px 1fr 250px;
    gap: 10px;
    align-items: start;
    font-size: 16px;
}

#combat-center {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#combat-actions button {
    padding: 10px 20px;
    font-size: 18px;
    margin: 5px;
    background-color: #333;
    color: #f0f0f0;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
}

#combat-actions button:hover {
    background-color: #555;
}

#combat-area {
    position: relative;
    width: 750px;
    height: 750px; /* match 15x15 grid height */
    margin: 0 auto;
}

#combat-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

/* Inventar Styles */
#inventory-screen {
    text-align: left;
    margin: 0 auto;
    width: 100%;
    background: linear-gradient(135deg, rgba(40, 35, 30, 0.9), rgba(50, 45, 40, 0.9));
    border: 2px solid #8B4513;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    box-sizing: border-box;
}

#inventory-screen h2 {
    color: #f5d742;
    font-size: 24px;
    font-weight: bold;
    margin: 0 0 20px 0;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    border-bottom: 2px solid #8B4513;
    padding-bottom: 8px;
}

#inventory-screen h3 {
    color: #D2B48C;
    font-size: 18px;
    font-weight: bold;
    margin: 16px 0 12px 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    border-bottom: 1px solid rgba(139, 69, 19, 0.4);
    padding-bottom: 4px;
}

#inventory-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 900px;
    overflow-y: auto;
}

.inventory-section {
    background-color: rgba(0, 0, 0, 0.4);
    padding: 10px;
    border-radius: 8px;
}

.inventory-section h3 {
    margin-top: 0;
}

.inventory-dropzone {
    min-height: 40px;
    border: 1px dashed #666;
    padding: 5px;
}

.inventory-slot {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
}

.slot-label {
    width: 70px;
    font-weight: bold;
    margin-right: 5px;
}

.empty-slot {
    color: #777;
    font-style: italic;
}

.item-effect {
    margin-left: 10px;
    font-size: 0.9em;
}

.rarity-common { color: #ffffff; }
.rarity-rare { color: #1e90ff; }
.rarity-epic { color: #a335ee; }
.rarity-legendary { color: #ff8000; }

.inventory-item {
    background-color: #444;
    padding: 10px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.inventory-item button {
    padding: 5px 10px;
    font-size: 14px;
    background-color: #333;
    color: #f0f0f0;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.inventory-item button:hover {
    background-color: #555;
}

#inventory-actions {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
}

footer {
    margin-top: 20px;
    font-size: 16px;
    background-color: rgba(0, 0, 0, 0.8);
    padding: 10px;
    border-top: 1px solid #666;
}

/* Miscellaneous */
button:focus, input:focus, select:focus {
    outline: none;
    box-shadow: 0 0 5px #f5d742;
}

#inventory-button {
    padding: 10px 20px;
    background-color: #333;
    color: #f0f0f0;
    border: none;
    font-size: 18px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
}

#inventory-button:hover {
    background-color: #555;
}

#quest-button {
    padding: 10px 20px;
    background-color: #333;
    color: #f0f0f0;
    border: none;
    font-size: 18px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
}

#quest-button:hover {
    background-color: #555;
}

#close-inventory {
    padding: 10px 20px;
    background-color: #333;
    color: #f0f0f0;
    border: none;
    font-size: 18px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
}

#close-inventory:hover {
    background-color: #555;
}

#spellbook-button {
    padding: 10px 20px;
    background-color: #333;
    color: #f0f0f0;
    border: none;
    font-size: 18px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
}

#spellbook-button:hover {
    background-color: #555;
}

#leavecity-button {
    padding: 10px 20px;
    background-color: #333;
    color: #f0f0f0;
    border: none;
    font-size: 18px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
}

#leavecity-button:hover {
    background-color: #555;
}

#close-spellbook {
    padding: 10px 20px;
    background-color: #333;
    color: #f0f0f0;
    border: none;
    font-size: 18px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
}

#close-spellbook:hover {
    background-color: #555;
}

#to-gold {
    padding: 10px 20px;
    background-color: #333;
    color: #f0f0f0;
    border: none;
    font-size: 18px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
}

#to-gold:hover {
    background-color: #555;
}

#combat-log-buttons {
    padding: 10px 20px;
    background-color: #333;
    color: #f0f0f0;
    border: none;
    font-size: 18px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
}

#combat-log-buttons:hover {
    background-color: #555;
}

/* SweetAlert2 Custom Styles */
.swal2-custom-popup {
    font-family: 'Georgia', serif;
    background-color: rgba(0, 0, 0, 0.8); /* Gleiche Hintergrundfarbe wie das Spiel */
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    color: #f0f0f0; /* Textfarbe */
    max-width: none; /* volle Breite */
}

.swal2-custom-title {
    color: #f5d742; /* Gleiche Farbe wie der Text in header/footer */
    font-size: 24px;
}

.swal2-custom-content {
    color: #f0f0f0;
    font-size: 18px;
}

.swal2-custom-button {
    background-color: #333;
    color: #f0f0f0;
    border-radius: 4px;
    border: none;
    font-size: 18px;
    padding: 10px 20px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.swal2-custom-button:hover {
    background-color: #555;
}

/* Hintergrundfarbe für das Dropdown-Menü in SweetAlert2 */
.swal2-custom-input select {
    background-color: rgba(0, 0, 0, 0.8); /* Gleiche Hintergrundfarbe wie das Spiel */
    color: #f0f0f0; /* Setze die Textfarbe */
    border: 1px solid #555; /* Gleicher Rand wie bei den anderen Elementen */
    padding: 8px; /* Innenabstand */
    border-radius: 4px; /* Abgerundete Ecken */
    font-family: 'Georgia', serif; /* Gleiche Schriftart wie im restlichen Design */
    font-size: 18px; /* Gleiche Schriftgröße wie in .swal2-custom-content */
}

/* Hover-Effekt für das Dropdown-Menü */
.swal2-custom-input select:hover {
    background-color: #333; /* Hintergrundfarbe bei Hover */
    color: #f5d742; /* Textfarbe bei Hover, passend zur Titel-Textfarbe */
}

/* Optional: Fokus-Effekt für das Dropdown-Menü */
.swal2-custom-input select:focus {
    outline: none;
    box-shadow: 0 0 5px #f5d742; /* Fokus-Rahmen passend zur Titel-Textfarbe */
}

/* Animation für Weltereignisse auf der Karte */
.world-event {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    pointer-events: none;
    animation: world-event-fade 1s ease-out forwards;
}

/* Pfad-Markierungen auf der Weltkarte */
.path-marker {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 0, 0.4);
    pointer-events: none;
}

/* Anzeige des Aggro-Radius von Gegnern */
.aggro-radius {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 0, 0, 0.25);
    border-radius: 50%;
    pointer-events: none;
}

@keyframes world-event-fade {
    from { transform: scale(0.5); opacity: 0.9; }
    to { transform: scale(1.5); opacity: 0; }
}

.layer {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none; /* Verhindere, dass die Ebenen das Klicken blockieren */
  width: calc(var(--grid-cell-size) * var(--grid-size));
  height: calc(var(--grid-cell-size) * var(--grid-rows));
  max-width: calc(100% - (var(--grid-padding) * 2));
  max-height: calc(100% - (var(--grid-padding) * 2));
  display: grid;
  grid-template-columns: repeat(var(--grid-size), var(--grid-cell-size));
  grid-template-rows: repeat(var(--grid-rows), var(--grid-cell-size));
  gap: var(--grid-gap);
  border-radius: 12px;
}

#map-terrain,
#dungeon-terrain,
#city-terrain {
    z-index: 1; /* untere Ebene */
    background-color: rgba(0, 0, 0, 0.5);
}

#map-objects,
#dungeon-objects,
#city-objects {
    z-index: 2; /* mittlere Ebene */
    pointer-events: auto;
    background-color: transparent;
}

#map-city-name {
    z-index: 3; /* obere Ebene */
    pointer-events: none;
}

#map-terrain div,
#map-objects div,
#map-city-name div,
#dungeon-terrain div,
#dungeon-objects div,
#city-terrain div,
#city-objects div {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(12px, 1.2vw, 18px);
    border-radius: 4px;
    box-sizing: border-box;
    position: relative;
}

#saveGameButton {
    padding: 10px 20px;
    background-color: #333;
    color: #f0f0f0;
    border: none;
    font-size: 18px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
}

#saveGameButton:hover {
    background-color: #555;
}

#loadGameButton {
    padding: 10px 20px;
    background-color: #333;
    color: #f0f0f0;
    border: none;
    font-size: 18px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
}

#loadGameButton:hover {
    background-color: #555;
}

#load-existing-game {
    padding: 10px 20px;
    background-color: #333;
    color: #f0f0f0;
    border: none;
    font-size: 18px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
}

#load-existing-game:hover {
    background-color: #555;
}

#start-character-creation {
    padding: 10px 20px;
    background-color: #333;
    color: #f0f0f0;
    border: none;
    font-size: 18px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
}

#start-character-creation:hover {
    background-color: #555;
}

#faq-button {
    padding: 10px 20px;
    background-color: #333;
    color: #f0f0f0;
    border: none;
    font-size: 18px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
}

#faq-button:hover {
    background-color: #555;
}

#impressum-button {
    padding: 5px 10px;
    background-color: #333;
    color: #f0f0f0;
    border: none;
    font-size: 15px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
}

#impressum-button:hover {
    background-color: #555;
}

#saveCharacterButton {
    padding: 10px 20px;
    background-color: #333;
    color: #f0f0f0;
    border: none;
    font-size: 18px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
}

#saveCharacterButton:hover {
    background-color: #555;
}

#loadCharacterButton {
    padding: 10px 20px;
    background-color: #333;
    color: #f0f0f0;
    border: none;
    font-size: 18px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
}

#loadCharacterButton:hover {
    background-color: #555;
}


/* CSS Animationen */

@keyframes moveAndFlip {
    0% { transform: translateX(-400px) scaleX(1); }
    50% { transform: translateX(400px) scaleX(1); }
    50.1% { transform: translateX(400px) scaleX(1); }
    100% { transform: translateX(-400px) scaleX(1); }
}

#animated-image-container {
    position: relative;
    overflow: hidden; /* Damit das Bild nur im Container sichtbar ist */
}

#animated-image {
    position: relative;
    animation: moveAndFlip 9s infinite linear; /* 4 Sekunden Laufzeit */
    height: 60px; /* Größe des Bildes */
}




.token-wrapper {
  position: absolute;
  width: 50px;
  height: 50px;
  pointer-events: auto; /* allow drag events */
  touch-action: none;
  transform: translate(-50%, -50%);
}

.token-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

#player-image,
#enemy-image,
.token-img {
  width: 50px;
  height: 50px;
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  transition: outline 0.2s ease-in-out;
}

.extra-enemy {
  width: 50px;
  height: 50px;
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  transition: outline 0.2s ease-in-out;
}

.extra-enemy:hover {
  outline: 2px solid cyan;
}
.extra-enemy:active {
  cursor: grabbing;
}

#player-image:active, #enemy-image:active {
  cursor: grabbing;
}

#player-image:hover, #enemy-image:hover {
  outline: 2px solid cyan;
}

.hp-bar-container{
  width:50px;
  height:5px;
  background-color:#444;
  border:1px solid #222;
  pointer-events:none;
  margin-top:0;
}

.hp-bar-container .fill{
  height:100%;
  width:100%;
  background-color:red;
}

.hp-bar-container.resource .fill{
  background-color:blue;
}

.hp-bar-container.resource{
  margin-top:1px;
}




/* Sädtenamen */
.city-label {
    color: #f5d742; /* Gleiche Farbe wie im Header/Footer */
    font-family: 'Georgia', serif; /* Konsistente Schriftart */
    font-size: 20px; /* Eine angenehme Größe für den Stadtnamen */
    font-weight: bold;
    text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.8); /* Schatten für besseren Kontrast */
    pointer-events: none; /* Verhindert Klicks auf Stadtnamen */
}

.building-label {
    color: #f5d742; /* Gleiche Farbe wie im Header/Footer */
    font-family: 'Georgia', serif; /* Konsistente Schriftart */
    font-size: 14px; /* Eine angenehme Größe für den Stadtnamen */
    font-weight: bold;
    text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.8); /* Schatten für besseren Kontrast */
    pointer-events: none; /* Verhindert Klicks auf Stadtnamen */
}

.npc-label {
    color: #f5d742;
    font-family: 'Georgia', serif;
    font-size: 14px;
    font-weight: bold;
    text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

.dungeon-label {
    color: #f5d742; /* Gleiche Farbe wie im Header/Footer */
    font-family: 'Georgia', serif; /* Konsistente Schriftart */
    font-size: 8px; /* Eine angenehme Größe für den Stadtnamen */
    font-weight: bold;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.8); /* Schatten für besseren Kontrast */
    pointer-events: none; /* Verhindert Klicks auf Stadtnamen */
}


/* Ladebalken für das Preloaden */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    color: #f0f0f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}


#progress-bar {
    width: 80%;
    height: 20px;
    background-color: #333;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 20px;
}

#progress-fill {
    height: 100%;
    width: 0;
    background-color: #f5d742;
    transition: width 0.1s ease;
}

#loading-text {
    margin-top: 10px;
    font-size: 18px;
}


#quest-interface {
    background: linear-gradient(135deg, rgba(40, 35, 30, 0.9), rgba(50, 45, 40, 0.9));
    border: 2px solid #8B4513;
    border-radius: 8px;
    padding: 20px;
    width: 100%;
    margin: 0 auto;
    color: #f0f0f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    box-sizing: border-box;
}

#quest-interface h2 {
    color: #f5d742;
    font-size: 24px;
    font-weight: bold;
    margin: 0 0 20px 0;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    border-bottom: 2px solid #8B4513;
    padding-bottom: 8px;
}

#quest-interface ul {
    list-style-type: none;
    padding: 0;
}

#quest-interface li {
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    margin: 5px 0;
    border-radius: 6px;
    border: 1px solid rgba(139, 69, 19, 0.5);
}

#quest-interface button {
    margin-top: 20px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #8B4513, #654321);
    color: #f0f0f0;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    transition: all 0.2s ease;
}

#quest-interface button:hover {
    background: linear-gradient(135deg, #A0522D, #8B4513);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* Ergebnisbildschirm */
#battle-result-screen {
    background: linear-gradient(135deg, rgba(40, 35, 30, 0.9), rgba(50, 45, 40, 0.9));
    border: 2px solid #8B4513;
    border-radius: 8px;
    padding: 20px;
    width: 100%;
    margin: 0 auto;
    color: #f0f0f0;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    box-sizing: border-box;
}

#battle-result-screen h2 {
    color: #f5d742;
    font-size: 24px;
    font-weight: bold;
    margin: 0 0 20px 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    border-bottom: 2px solid #8B4513;
    padding-bottom: 8px;
}

#battle-result-screen ul {
    list-style-type: none;
    padding: 0;
    margin-bottom: 20px;
}

#battle-result-screen li {
    padding: 8px;
    background: rgba(0, 0, 0, 0.3);
    margin: 4px 0;
    border-radius: 4px;
    border: 1px solid rgba(139, 69, 19, 0.5);
}

.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.85);
    color: #f0f0f0;
    padding: 4px 8px;
    border-radius: 4px;
    pointer-events: none;
    white-space: pre-line;
    font-size: 0.8em;
    z-index: 10000;
}

#quest-filters {
    margin-bottom: 10px;
}

#quest-filters button {
    padding: 10px;
    margin-right: 5px;
    background-color: #333;
    color: #f0f0f0;
    border: none;
    cursor: pointer;
    border-radius: 4px;
}

#quest-filters button:hover {
    background-color: #555;
}

.quest-progress {
    width: 100%;
    background-color: #444;
    border-radius: 4px;
    overflow: hidden;
    margin: 5px 0;
}

.quest-progress-bar {
    height: 10px;
    background-color: #4caf50;
    width: 0;
}

.dialog-box {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translate(-50%, -20%);
    background-color: rgba(0, 0, 0, 0.8);
    padding: 20px;
    border-radius: 8px;
    color: #f0f0f0;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.dialog-box button {
    margin-top: 10px;
    padding: 10px;
    background-color: #333;
    color: #f0f0f0;
    border: none;
    cursor: pointer;
    border-radius: 4px;
}

.quest-marker {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
}

.quest-marker img {
    width: 24px;
    height: 24px;
}

.dialog-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.dialog-options button {
    background: #333;
    color: #f0f0f0;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 4px;
}
#error-messages {
    color: #f88;
    white-space: pre-wrap;
    margin-top: 10px;
}
#cheat-console textarea {
    width: 100%;
    height: 60px;
    background: #111;
    color: #0f0;
    border: 1px solid #555;
    margin: 10px 0;
    font-family: monospace;
}
#cheat-console pre {
    color: #0f0;
    text-align: left;
    white-space: pre-wrap;
}
#debug-toggle {
    position: fixed;
    bottom: 0;
    right: 0;
    z-index: 2100;
    padding: 8px 12px;
    background: #333;
    color: #f0f0f0;
    border: none;
    cursor: pointer;
    border-radius: 4px 0 0 0;
}
#dm-panel-toggle {
    position: fixed;
    bottom: 40px;
    right: 0;
    z-index: 2100;
    padding: 8px 12px;
    background: #333;
    color: #f0f0f0;
    border: none;
    cursor: pointer;
    border-radius: 4px 0 0 0;
}


.notification-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}
.toast {
    background-color: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 10px 20px;
    margin-top: 10px;
    border-radius: 4px;
    opacity: 0;
    transform: translateX(100%);
    transition: opacity 0.3s, transform 0.3s;
}
.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.effect-icons {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

.effect-icon {
    position: relative;
}

.effect-icon img {
    width: 24px;
    height: 24px;
}

.stack-count {
    position: absolute;
    bottom: -4px;
    right: -4px;
    background: rgba(0,0,0,0.7);
    color: white;
    border-radius: 50%;
    padding: 1px 3px;
    font-size: 0.7em;
}

.status-overlay {
    pointer-events: none;
    animation: status-fade 1s linear forwards;
    background-size: contain;
    background-repeat: no-repeat;
}

.status-overlay.frozen { background-image: url('icons/Icon.1_30.png'); }
.status-overlay.burning { background-image: url('icons/Icon.1_31.png'); }
.status-overlay.blinded { background-image: url('icons/Icon.1_32.png'); }
.status-overlay.stronger { background-image: url('icons/Icon.1_33.png'); }
.status-overlay.stunned { background-image: url('icons/Icon.1_34.png'); }
.status-overlay.poisoned { background-image: url('icons/Icon.1_35.png'); }
.status-overlay.restrained { background-image: url('icons/Icon.1_36.png'); }
.status-overlay.prone { background-image: url('icons/Icon.1_37.png'); }
.status-overlay.paralyzed { background-image: url('icons/Icon.1_38.png'); }

/* Minimap - now positioned in the game menu */
#minimap {
    position: relative;
    width: 100%;
    max-width: 200px;
    height: 200px;
    background-color: rgba(0,0,0,0.7);
    border: 2px solid #8B4513;
    border-radius: 6px;
    margin: 0 auto 15px auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

#minimap-path {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#minimap-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

#minimap-markers {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.minimap-marker {
    position: absolute;
    width: 12px;
    height: 12px;
    transform: translate(-50%, -50%);
    cursor: pointer;
}

.minimap-marker img {
    width: 100%;
    height: 100%;
}

@keyframes status-fade {
    from { opacity: 1; }
    to { opacity: 0; }
}

body[data-season="winter"] #map-terrain div { filter: brightness(0.8) grayscale(0.3); }
body[data-season="spring"] #map-terrain div { filter: brightness(1.1); }
body[data-season="summer"] #map-terrain div { filter: brightness(1.2) saturate(1.2); }
body[data-season="herbst"] #map-terrain div { filter: hue-rotate(-20deg) saturate(0.8); }

body[data-weather="regen"] #map-container::after,
body[data-weather="schnee"] #map-container::after,
body[data-weather="nebel"] #map-container::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    background: rgba(0,0,0,0.2);
}

.dnd-sheet {
    font-family: 'Georgia', serif;
    color: #f0f0f0;
    width: 100%;
}
.dnd-header { text-align: center; color: #f5d742; margin-bottom: 10px; }
.dnd-section { margin-bottom: 15px; }
.dnd-table { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.dnd-table th, .dnd-table td { border: 1px solid #555; padding: 4px; }
.dnd-table th { background: #333; }
.dnd-sheet details { margin-bottom: 10px; }
.dnd-sheet summary {
    cursor: pointer;
    color: #f5d742;
    font-weight: bold;
    margin-bottom: 5px;
}
/* Hex grid for combat */
#grid-layer,
#terrain-layer,
#token-layer,
#move-overlay {
    position: absolute;
    left: 0;
    top: 0;
}

#grid-layer {
    z-index: 4; /* above terrain and tokens */
    pointer-events: none;
}

#terrain-layer {
    z-index: 1;
    pointer-events: none;
}

.grid-terrain {
    position: absolute;
    left: 0;
    top: 0;
}

.grid-lines {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 4;
    pointer-events: none;
}

#token-layer {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    pointer-events: auto; /* allow drag events on tokens */
    z-index: 3;
}

#token-layer img {
    pointer-events: auto;
}

#move-overlay {
    position: absolute;
    left: 0;
    top: 0;
    pointer-events: none;
    z-index: 5; /* topmost overlay layer */
}

#move-overlay .move-hex {
    position: absolute;
    width: 50px;
    height: 50px;
    pointer-events: none;
}

#move-overlay .move-hex.in-range {
    background-color: rgba(0, 255, 0, 0.2);
    outline: 3px solid lime;
}

#move-overlay .move-hex.path {
    background-color: rgba(255, 165, 0, 0.2);
    outline: 2px dashed orange;
}

#move-overlay .move-hex.hover-target {
    outline: 3px solid red;
}
.grid-cell {
    position: absolute;
    width: 50px;
    height: 50px;
    cursor: pointer;
    pointer-events: auto;
}

.grid-border {
    position: absolute;
    width: 50px;
    height: 50px;
    pointer-events: none;
    border: 2px solid rgba(255, 255, 255, 0.6);
    background: rgba(120, 120, 120, 0.15);
}
.grid-border .grid-coord {
    position: absolute;
    top: 0;
    left: 2px;
    font-size: 10px;
    color: #fff;
    pointer-events: none;
    text-shadow: 1px 1px 2px #000;
}
.grid-cell.row-even, .grid-border.row-even { filter: brightness(1); }
.grid-cell.row-odd, .grid-border.row-odd { filter: brightness(0.9); }
.grid-cell.in-range {
    outline: 3px solid yellow;
    background-color: rgba(255, 255, 0, 0.2);
    z-index: 1;
}
.grid-cell.path {
    outline: 2px dashed orange;
    background-color: rgba(255, 165, 0, 0.2);
}
.grid-cell.hover-target {
    outline: 3px solid red;
    z-index: 2;
}

.grid-cell.terrain-plain {
    background-image: url('bilder/grastile.png');
    background-size: cover;
}

.grid-cell.terrain-grass1 {
    background-image: url('bilder/grastile1.png');
    background-size: cover;
}

.grid-cell.terrain-grass2 {
    background-image: url('bilder/grastile2.png');
    background-size: cover;
}

.grid-cell.terrain-grass3 {
    background-image: url('bilder/grastile3.png');
    background-size: cover;
}

.grid-cell.terrain-grass4 {
    background-image: url('bilder/grastile4.png');
    background-size: cover;
}

.grid-cell.terrain-grass5 {
    background-image: url('bilder/grastile5.png');
    background-size: cover;
}

.grid-cell.terrain-grass6 {
    background-image: url('bilder/grastile6.png');
    background-size: cover;
}

.grid-cell.terrain-grass7 {
    background-image: url('bilder/grastile7.png');
    background-size: cover;
}

.grid-cell.terrain-forest {
    background-image: url('bilder/waldtile.png');
    background-size: cover;
}

.grid-cell.terrain-forest1 {
    background-image: url('bilder/waldtile1.png');
    background-size: cover;
}

.grid-cell.terrain-rock {
    background-image: url('bilder/gebirge1.png');
    background-size: cover;
}

.grid-cell.terrain-tree {
    background-image: url('bilder/waldtile.png');
    background-size: cover;
}

.grid-cell.terrain-desert {
    background-image: url('bilder/wueste1.png');
    background-size: cover;
}

.grid-cell.terrain-water {
    background-image: url('bilder/wasser1.png');
    background-size: cover;
}

.grid-cell.terrain-mud {
    background-image: url('bilder/wueste1.png');
    background-size: cover;
}

.grid-cell.terrain-path-ew {
    background-image: url('bilder/grastilewayeasttowest.png');
    background-size: cover;
}

.grid-cell.terrain-path-ns {
    background-image: url('bilder/grastilewaynorthtosouth.png');
    background-size: cover;
}

.grid-cell.terrain-path-cross {
    background-image: url('bilder/grastilecrossway.png');
    background-size: cover;
}

.context-menu {
    position: absolute;
    background: #222;
    border: 1px solid #555;
    padding: 4px;
    z-index: 10;
}

.context-menu button {
    display: block;
    width: 100%;
    background: none;
    border: none;
    color: #fff;
    text-align: left;
    padding: 4px 8px;
    cursor: pointer;
}

.context-menu button:hover {
    background: #444;
}

/* Weapon Range Visualization */
.grid-cell.weapon-range {
    background-color: rgba(0, 255, 0, 0.3) !important;
    border: 2px solid rgba(0, 255, 0, 0.6);
}

.grid-cell.weapon-range-max {
    background-color: rgba(255, 255, 0, 0.2) !important;
    border: 2px solid rgba(255, 255, 0, 0.5);
}

.grid-cell.enemy-in-range {
    background-color: rgba(255, 0, 0, 0.4) !important;
    border: 3px solid rgba(255, 0, 0, 0.8);
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.6);
}

.grid-cell.enemy-in-max-range {
    background-color: rgba(255, 165, 0, 0.4) !important;
    border: 3px solid rgba(255, 165, 0, 0.8);
    box-shadow: 0 0 10px rgba(255, 165, 0, 0.6);
}

.grid-cell.weapon-range:hover {
    background-color: rgba(0, 255, 0, 0.5) !important;
}

.grid-cell.enemy-in-range:hover {
    background-color: rgba(255, 0, 0, 0.6) !important;
    cursor: crosshair;
}

/* Inventory sections styling to match combat UI */
#inventory-list > div,
.inventory-section {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    padding: 12px;
    margin: 8px 0;
    border: 1px solid rgba(139, 69, 19, 0.5);
}

.inventory-category {
    color: #D2B48C;
    font-weight: bold;
    margin-bottom: 8px;
}

.inventory-item {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 4px;
    padding: 8px;
    margin: 4px 0;
    border: 1px solid rgba(139, 69, 19, 0.3);
}

.inventory-item:hover {
    background: rgba(139, 69, 19, 0.2);
}

/* ========================================
   TUTORIAL SYSTEM STYLES
   ======================================== */

/* Tutorial Overlay - Nicht-blockierend, erlaubt Interaktion */
.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.3);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none; /* Erlaubt Klicks durch Overlay */
    animation: tutorialFadeIn 0.3s ease-in-out;
    will-change: opacity; /* Optimiert Animation */
}

@keyframes tutorialFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Tutorial Content Box - Kompakter und nicht-blockierend */
.tutorial-content {
    background: linear-gradient(135deg, rgba(40, 35, 30, 0.98), rgba(50, 45, 40, 0.98));
    border: 3px solid #8B4513;
    border-radius: 12px;
    padding: 20px;
    max-width: 420px;
    width: 85%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
    position: relative;
    animation: tutorialSlideIn 0.4s ease-out;
    pointer-events: auto; /* Tutorial-Box ist interaktiv */
    transition: none; /* Keine Transition um Flackern zu vermeiden */
}

/* Tutorial Content Update - Keine Animation bei Updates */
.tutorial-content-update {
    animation: none !important;
}

@keyframes tutorialSlideIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Position Varianten */
.tutorial-content.top {
    margin-top: 80px;
}

.tutorial-content.bottom {
    margin-top: auto;
    margin-bottom: 80px;
}

.tutorial-content.center {
    /* Default - centered by flex */
}

/* Tutorial Header */
.tutorial-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    border-bottom: 2px solid #8B4513;
    padding-bottom: 12px;
}

.tutorial-header h3 {
    margin: 0;
    color: #f5d742;
    font-size: 22px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.tutorial-close {
    background: rgba(139, 69, 19, 0.3);
    border: 2px solid #8B4513;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 24px;
    line-height: 1;
    color: #f0f0f0;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tutorial-close:hover {
    background: rgba(139, 69, 19, 0.6);
    transform: scale(1.1);
}

/* Tutorial Body */
.tutorial-body {
    margin-bottom: 20px;
}

.tutorial-body p {
    color: #f0f0f0;
    font-size: 16px;
    line-height: 1.6;
    margin: 0;
    text-align: left;
}

/* Tutorial Progress Bar */
.tutorial-progress {
    margin-bottom: 20px;
}

.tutorial-progress-bar {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid #8B4513;
    border-radius: 12px;
    height: 24px;
    overflow: hidden;
    position: relative;
}

.tutorial-progress-fill {
    background: linear-gradient(90deg, #f5d742, #d4af37);
    height: 100%;
    transition: width 0.4s ease-out;
    box-shadow: 0 0 10px rgba(245, 215, 66, 0.5);
}

.tutorial-progress-text {
    display: block;
    text-align: center;
    color: #f5d742;
    font-size: 13px;
    margin-top: 6px;
    font-weight: bold;
}

/* Tutorial Footer Buttons */
.tutorial-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.tutorial-btn {
    padding: 10px 20px;
    border: 2px solid #8B4513;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Georgia', serif;
}

.tutorial-btn-primary {
    background: linear-gradient(135deg, #8B4513, #A0522D);
    color: #f5d742;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.tutorial-btn-primary:hover {
    background: linear-gradient(135deg, #A0522D, #8B4513);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

.tutorial-btn-secondary {
    background: rgba(40, 35, 30, 0.8);
    color: #f0f0f0;
    border-color: #666;
}

.tutorial-btn-secondary:hover {
    background: rgba(50, 45, 40, 0.9);
    border-color: #888;
}

/* Tutorial Highlight - Markierung von Elementen mit stärkerem Effekt */
.tutorial-highlight {
    position: absolute;
    border: 4px solid #f5d742;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(245, 215, 66, 0.8), inset 0 0 20px rgba(245, 215, 66, 0.3);
    pointer-events: none;
    z-index: 9999;
    animation: tutorialPulse 2s infinite;
    will-change: box-shadow, border-width; /* Optimiert Animation */
}

/* Arrow Pointer - Zeigt auf hervorgehobenes Element */
.tutorial-arrow {
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
    z-index: 9998;
    pointer-events: none;
    animation: tutorialArrowBounce 1s infinite;
    will-change: transform; /* Optimiert Animation */
}

.tutorial-arrow.arrow-top {
    border-width: 0 20px 30px 20px;
    border-color: transparent transparent #f5d742 transparent;
    filter: drop-shadow(0 0 10px rgba(245, 215, 66, 0.8));
}

.tutorial-arrow.arrow-bottom {
    border-width: 30px 20px 0 20px;
    border-color: #f5d742 transparent transparent transparent;
    filter: drop-shadow(0 0 10px rgba(245, 215, 66, 0.8));
}

.tutorial-arrow.arrow-left {
    border-width: 20px 30px 20px 0;
    border-color: transparent #f5d742 transparent transparent;
    filter: drop-shadow(0 0 10px rgba(245, 215, 66, 0.8));
}

.tutorial-arrow.arrow-right {
    border-width: 20px 0 20px 30px;
    border-color: transparent transparent transparent #f5d742;
    filter: drop-shadow(0 0 10px rgba(245, 215, 66, 0.8));
}

@keyframes tutorialArrowBounce {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-10px) scale(1.1);
    }
}

@keyframes tutorialPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(245, 215, 66, 0.8), inset 0 0 20px rgba(245, 215, 66, 0.3);
        border-width: 4px;
    }
    50% {
        box-shadow: 0 0 35px rgba(245, 215, 66, 1), inset 0 0 35px rgba(245, 215, 66, 0.6);
        border-width: 5px;
    }
}

/* Tutorial Resume Button (für pausiertes Tutorial) */
.tutorial-resume-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #8B4513, #A0522D);
    color: #f5d742;
    border: 2px solid #f5d742;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
    animation: tutorialBounce 2s infinite;
    font-family: 'Georgia', serif;
}

@keyframes tutorialBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

.tutorial-resume-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.8);
}

/* Responsive Anpassungen */
@media (max-width: 768px) {
    .tutorial-content {
        max-width: 95%;
        padding: 16px;
    }
    
    .tutorial-header h3 {
        font-size: 18px;
    }
    
    .tutorial-body p {
        font-size: 14px;
    }
    
    .tutorial-footer {
        flex-direction: column;
    }
    
    .tutorial-btn {
        width: 100%;
    }
}

/* ── Auth-Screen (Anmeldung / Registrierung) ──────────────────────────── */
#auth-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.auth-box {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 12px;
    padding: 40px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.auth-box h1 {
    color: #ffd700;
    margin-bottom: 10px;
    font-size: 2rem;
}

.auth-box img {
    margin-bottom: 20px;
    border-radius: 50%;
    border: 2px solid rgba(255, 215, 0, 0.4);
}

.auth-tabs {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 20px;
}

.auth-tab {
    flex: 1;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.auth-tab--active,
.auth-tab:focus {
    opacity: 1;
    outline: 2px solid #ffd700;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
}

.auth-form label {
    color: #ccc;
    font-size: 0.85rem;
    margin-bottom: 2px;
}

.auth-form input {
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.auth-form input:focus {
    border-color: #ffd700;
}

.auth-form button[type="submit"] {
    margin-top: 8px;
    width: 100%;
    padding: 12px;
    font-size: 1rem;
}

.auth-error {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: 6px;
    padding: 10px;
    margin: 8px 0;
    font-size: 0.9rem;
    text-align: left;
}

.auth-required {
    color: #ff6b6b;
}
