/* ============================================================================
   1. GLOBALE STYLES & LAYOUT
   ============================================================================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Courier New', Courier, monospace;
}

body {
    background-color: #0b0f19;
    color: #e2e8f0;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    user-select: none;
}

/* ============================================================================
   2. PERMANENTER LANDING CONTAINER (VOR LOGIN)
   ============================================================================ */
#landing-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000000 url('titlescreen.jpg') center center no-repeat;
    background-size: cover;
    z-index: 9998;
}

#landing-content-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end; 
    padding-bottom: 6vh; 
    width: 100%;
    height: 100%;
    gap: 20px; 
}

#version-link {
    position: fixed;
    bottom: 10px;
    left: 15px;
    color: #4c566a;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 1px;
    cursor: pointer;
    text-shadow: 1px 1px 2px #000;
    z-index: 9999;
    transition: color 0.2s;
}

#legal-links {
    position: fixed;
    bottom: 10px;
    right: 15px;
    color: #4c566a;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 1px;
    text-shadow: 1px 1px 2px #000;
    z-index: 9999;
}

#legal-links a {
    color: #4c566a;
    text-decoration: none;
    transition: color 0.2s;
}

#legal-links a:hover {
    color: #60a5fa;
}
#version-link:hover {
    color: #60a5fa;
}

#motd-marquee-container {
    width: 50%;
    max-width: 650px;
    background: rgba(2, 6, 23, 0.85);
    border: 2px solid #334155;
    border-radius: 4px;
    padding: 8px 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

#motd-marquee-text {
    color: #facc15;
    font-size: 14px;
    font-weight: bold;
    text-shadow: 1px 1px 0px #000;
    letter-spacing: 1px;
}

#landing-socials {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.social-link-btn {
    padding: 8px 14px; 
    background: rgba(15, 23, 42, 0.9); 
    color: #fff; 
    text-decoration: none; 
    border: 2px solid #334155; 
    border-radius: 4px; 
    font-family: monospace; 
    font-weight: bold;
    font-size: 12px;
    transition: all 0.2s; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.5);
}

.social-link-btn:hover {
    color: #facc15;
    border-color: #facc15;
    background: rgba(30, 41, 59, 0.9);
    transform: translateY(-2px);
}

.discord-highlight {
    background: #5865F2 !important;
    border-color: #7289da !important;
}
.discord-highlight:hover {
    background: #4752c4 !important;
}

/* ============================================================================
   3. TITLE SCREEN OVERLAY (HAUPTMENÜ NACH LOGIN)
   ============================================================================ */
#title-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000000 url('titlescreen.jpg') center center no-repeat;
    background-size: cover;
    z-index: 9995;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 22vh; 
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

#title-screen button, 
#start-button, 
#btn-admin-link, 
#btn-leaderboard, 
#btn-logout {
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: #e2e8f0 !important;
    font-size: 26px !important;
    font-weight: bold !important;
    letter-spacing: 3px !important;
    cursor: pointer !important;
    outline: none !important;
    text-shadow: 0px 0px 8px rgba(255, 255, 255, 0.5) !important;
    padding: 10px 20px !important;
    transition: text-shadow 0.2s, transform 0.2s, color 0.2s !important;
    text-transform: uppercase !important;
    font-family: 'Courier New', Courier, monospace !important;
    display: inline-block !important;
    width: auto !important;
}

#title-screen button:hover, 
#start-button:hover, 
#btn-admin-link:hover, 
#btn-leaderboard:hover, 
#btn-logout:hover {
    color: #facc15 !important;
    text-shadow: 0px 0px 12px rgba(250, 204, 21, 0.8) !important;
    transform: scale(1.05) !important;
}

#start-button {
    animation: retroBlink 1.5s infinite ease-in-out !important;
}

@keyframes retroBlink {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* ============================================================================
   4. INGAME CONTAINER & FLEXBOX GRID (FIX: Stell das 3-Spalten-Layout wieder her)
   ============================================================================ */
#game-container {
    display: flex;
    flex-direction: row; /* FIX: Sidebars nebeneinander anordnen */
    width: 100vw;
    height: 100vh;
    padding: 15px;
    gap: 15px;
    position: absolute;
    top: 0;
    left: 0;
}

#left-sidebar, #sidebar {
    width: 320px;
    height: 100%;
    background-color: #0f172a; 
    padding: 15px;
    display: flex;
    flex-direction: column;
    border: 2px solid #1e293b;
    border-radius: 6px;
    z-index: 10;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
    flex-shrink: 0; /* Verhindert, dass die Sidebars zerquetscht werden */
}

#view-viewport {
    flex-grow: 1; /* Nimmt den gesamten mittleren Platz ein */
    height: 100%;
    position: relative;
    background-color: #020617;
    border: 2px solid #1e293b;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

canvas {
    display: block;
    outline: none;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    box-shadow: 0 0 50px rgba(0,0,0,1);
    image-rendering: pixelated;
}

/* ============================================================================
   5. INGAME BOXEN & STATS
   ============================================================================ */
.ui-box {
    background-color: #1e293b;
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.ui-box h3 {
    margin-bottom: 10px;
    font-size: 14px;
    color: #94a3b8;
    border-bottom: 1px solid #334155;
    padding-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-size: 13px;
}

.stat-line {
    background: #020617;
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid #334155;
    display: flex;
    justify-content: space-between;
}

.stat-line span {
    font-weight: bold;
    color: #f8fafc;
}

/* ============================================================================
   6. SKILLTREE & AMINATIOUN
   ============================================================================ */
.skill-tree-box {
    flex-grow: 0;
}
.skill-info {
    font-size: 12px;
    margin-bottom: 10px;
    color: #cbd5e1;
}
.skill-btn {
    width: 100%;
    padding: 6px;
    margin-bottom: 6px;
    background: #0f172a;
    border: 1px solid #3b82f6;
    color: #bfdbfe;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    display: flex;
    justify-content: space-between;
    transition: all 0.2s;
}
.skill-btn:disabled {
    background: #020617;
    border: 1px solid #334155;
    color: #64748b;
    cursor: not-allowed;
}

@keyframes skillReadyGlow {
    0% { box-shadow: 0 0 5px rgba(16, 185, 129, 0.2); border-color: #10b981; }
    50% { box-shadow: 0 0 15px rgba(16, 185, 129, 0.8); border-color: #34d399; }
    100% { box-shadow: 0 0 5px rgba(16, 185, 129, 0.2); border-color: #10b981; }
}

.skill-btn:not(:disabled) {
    animation: skillReadyGlow 1.5s infinite alternate;
    color: #fff;
    font-weight: bold;
}

.skill-btn:not(:disabled):hover {
    background: #059669;
}

.skill-lvl {
    background: #020617;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    color: #facc15;
}

/* ============================================================================
   7. COMBAT LOG
   ============================================================================ */
.log-box {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#combat-log {
    flex-grow: 1;
    overflow-y: auto;
    font-size: 11px;
    line-height: 1.4;
    padding: 8px;
    background: #020617;
    border-radius: 4px;
    border: 1px inset #334155;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.log-normal { color: #cbd5e1; }
.log-damage { color: #f87171; }
.log-victory { color: #4ade80; }
.log-important { color: #facc15; font-weight: bold; }

/* ============================================================================
   8. RUCKSACK & INVENTAR
   ============================================================================ */
.inventory-box {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden; 
}
.inventory-scroll-container {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 5px;
}

.inv-category {
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 5px;
    border-bottom: 1px solid #334155;
    padding-bottom: 2px;
}

.inv-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.inventory-item {
    background: #020617;
    padding: 6px;
    border: 1px solid #334155;
    border-radius: 4px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    font-size: 12px;
}

.item-count {
    color: #facc15;
    margin-right: 5px;
    font-weight: bold;
}

.item-title {
    color: #f8fafc;
    font-weight: bold;
    display: block;
}

.item-stats {
    font-size: 10px;
    color: #cbd5e1;
}

.use-btn, .drop-btn {
    background: #1e293b;
    border: 1px solid #475569;
    color: #fff;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 10px;
    transition: all 0.2s;
}

.use-btn:hover { background: #3b82f6; border-color: #60a5fa; }
.drop-btn { background: #7f1d1d; border-color: #b91c1c; }
.drop-btn:hover { background: #ef4444; border-color: #f87171; }

.ui-item-icon {
    width: 32px;
    height: 32px;
    background-image: url('assets/Items.png');
    background-repeat: no-repeat;
    image-rendering: pixelated;
    display: inline-block;
    flex-shrink: 0;
    border-radius: 4px;
    border: 1px solid #334155;
    background-color: #020617;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.8);
}

/* ============================================================================
   9. EQUIPMENT ANATOMIE GRID
   ============================================================================ */
.equip-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-gap: 6px;
    justify-items: center;
    align-items: center;
    background-color: #0f172a;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #334155;
    margin-bottom: 15px;
}

.equip-slot-box {
    width: 48px;
    height: 48px;
    background-color: #1e293b;
    border: 2px dashed #475569;
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    cursor: pointer;
    transition: border-color 0.2s;
}

.equip-slot-box:hover { border-color: #3b82f6; }

.equip-badge {
    position: absolute;
    bottom: -8px;
    background: #020617;
    border: 1px solid #334155;
    font-size: 9px;
    padding: 1px 4px;
    border-radius: 4px;
    color: #94a3b8;
    pointer-events: none;
    z-index: 2;
}

/* ============================================================================
   10. POPUPS, OVERLAYS & BALKEN
   ============================================================================ */
#game-tooltip {
    position: absolute;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid #475569;
    padding: 10px;
    border-radius: 6px;
    color: #fff;
    font-size: 12px;
    pointer-events: none; 
    z-index: 9999;
    display: none; 
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.8);
    min-width: 120px;
}
.tooltip-title { color: #facc15; font-weight: bold; font-size: 14px; margin-bottom: 2px; }
.tooltip-stat { display: flex; justify-content: space-between; width: 100%; gap: 10px; }
.tooltip-good { color: #4ade80; }
.tooltip-bad { color: #f87171; }

#death-screen {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(100, 0, 0, 0.8);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    display: none; 
}
#death-screen h1 { font-size: 64px; text-shadow: 2px 2px 10px black; margin-bottom: 20px; }

#top-bar-overlay {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    display: none;
    gap: 20px;
    align-items: center;
    background: rgba(15, 23, 42, 0.8);
    padding: 8px 20px;
    border-radius: 8px;
    border: 2px solid #334155;
    box-shadow: 0 4px 15px rgba(0,0,0,0.8);
}

.hp-bar-wrapper, .xp-bar-wrapper {
    width: 250px;
    height: 24px;
    background: #020617;
    border: 2px solid #334155;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

#top-bar-hp-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #ef4444, #dc2626);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#top-bar-xp-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#top-bar-hp-text, #top-bar-xp-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    text-align: center;
    line-height: 20px;
    font-size: 12px;
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 0 #000;
}

/* FIX: Admin-Control Panel absolut im Viewport fixieren, statt das Layout zu sprengen */
#admin-console-overlay {
    position: absolute;
    top: 20px; 
    right: 20px;
    width: 260px;
    background: rgba(15, 23, 42, 0.95);
    border: 2px solid #ef4444;
    padding: 15px;
    border-radius: 6px;
    color: #fff;
    z-index: 9000;
    display: none; 
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.4);
}
#admin-console-overlay h2 {
    color: #ef4444;
    text-align: center;
    margin-bottom: 12px;
    font-size: 14px;
}
.admin-btn {
    width: 100%;
    padding: 6px;
    margin-bottom: 6px;
    background: #1e293b;
    color: #fff;
    border: 1px solid #475569;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 11px;
    transition: 0.2s;
}
.admin-btn:hover { background: #ef4444; border-color: #f87171; }
.godmode-on { background: #10b981 !important; border-color: #34d399 !important; color: #020617 !important; }
.admin-footer {
    text-align: center;
    font-size: 10px;
    color: #94a3b8;
    margin-top: 10px;
}

/* ============================================================================
   11. LEADERBOARD POPUP
   ============================================================================ */
.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 13px;
}
.leaderboard-table th { background: #334155; color: #facc15; padding: 8px; text-align: left; }
.leaderboard-table td { border-bottom: 1px solid #1e293b; padding: 8px; }

/* ============================================================================
   12. LOGIN / REGISTER SYSTEM INNER DESIGN
   ============================================================================ */
.auth-box {
    width: 350px;
    background: rgba(15, 23, 42, 0.95);
    padding: 25px 30px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
    border: 2px solid #334155;
    border-radius: 6px;
}
.auth-box h3 { margin-bottom: 15px; color: #facc15; font-size: 18px; }

.tab-container { display: flex; margin-bottom: 20px; }
.tab-btn {
    flex: 1; padding: 10px; background: #1e293b; color: #94a3b8; border: 1px solid #334155;
    font-weight: bold; font-size: 11px; cursor: pointer; text-shadow: 1px 1px 0px #000; transition: all 0.1s ease;
}
.tab-btn:hover:not(.active) { color: #e2e8f0; border-color: #475569; }

#tab-login.active {
    background-color: #f59e0b; color: #020617; border: 3px solid #fef08a; text-shadow: none;
    box-shadow: inset -2px -2px 0px #b45309, inset 2px 2px 0px #fef08a;
}
#tab-register.active {
    background-color: #3b82f6; color: white; border: 3px solid #60a5fa;
    box-shadow: inset -2px -2px 0px #1d4ed8, inset 2px 2px 0px #93c5fd;
}

.auth-form input { width: 100%; padding: 10px; margin-bottom: 12px; background-color: #020617; border: 3px solid #334155; color: #f8fafc; font-size: 13px; }

.submit-btn {
    width: 100%; padding: 12px; background-color: #10b981; color: #020617; border: 3px solid #34d399;
    font-weight: bold; font-size: 14px; cursor: pointer; transition: transform 0.1s ease; box-shadow: inset -2px -2px 0px rgba(0,0,0,0.3);
}
.submit-btn:hover { transform: scale(1.02); }
.submit-btn:active { transform: scale(0.98); }