:root {
    /* Winds of Valen Color Palette */
    --accent: #b45309; /* Warm Amber/Rust */
    --highlight: #fbbf24; /* Golden Sunlight */
    --bg-dark: #0f172a; 
    --panel-bg: rgba(30, 20, 10, 0.85); /* Dark Sepia Transparent */
    --gold: #f59e0b;
    --gem-slot: #1a120b;
    --border-color: #78350f;
    --text-main: #fef3c7;
}

* {
    box-sizing: border-box;
    scroll-behavior: smooth;
}

/* --- THEMED SCROLLBARS --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

::-webkit-scrollbar-thumb {
    background-color: var(--highlight);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--accent);
}


body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: url('https://img.itch.zone/aW1hZ2UvMzk1ODQ1Ny8yNDI2NjgzOC5wbmc=/original/2vOCRa.png') no-repeat center center fixed;
    background-size: cover;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding-bottom: 50px; 
}

/* MOBILE NAVIGATION BAR */
.mobile-nav {
    display: none; /* Hidden on desktop */
    position: sticky;
    top: 0;
    width: 100%;
    background: #1a120b;
    border-bottom: 2px solid var(--gold);
    z-index: 2000;
    overflow-x: auto;
    white-space: nowrap;
    padding: 10px 5px;
}

.nav-link {
    color: var(--highlight);
    text-decoration: none;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    padding: 8px 12px;
    border: 1px solid var(--accent);
    margin: 0 4px;
    background: rgba(180, 83, 9, 0.2);
    border-radius: 4px;
}

/* TOOLTIP STYLES */
#tooltip {
    position: fixed;
    display: none;
    background: rgba(20, 10, 5, 0.95);
    border: 2px solid var(--gold);
    padding: 12px;
    border-radius: 4px;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.3);
    min-width: 200px;
    max-width: 320px;
}

#tooltip h4 { margin: 0 0 8px 0; color: var(--highlight); border-bottom: 1px solid var(--accent); padding-bottom: 5px; }
.tt-row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 3px; }
.tt-label { color: #d97706; margin-right: 20px; }
.tt-val { color: #fff; font-weight: bold; }
.tt-desc { color: #d6d3d1; font-style: italic; font-size: 12px; line-height: 1.4; }

/* COMPARISON STYLES */
.comp-pos { color: #22c55e !important; } /* Green */
.comp-neg { color: #ef4444 !important; } /* Red */

/* SOURCE STYLING */
.tt-source { font-size: 11px; margin-top: 2px; border-top: 1px solid rgba(180, 83, 9, 0.3); padding-top: 2px; }
.tt-source-drop { color: #ef4444; } /* Red for drops */
.tt-source-vendor { color: #add8e6; } /* Light Blue for Stall/Anvil */

.title {
    width: 100%;
    text-align: center;
    padding: 30px 0;
    font-size: 32px;
    font-weight: bold;
    border-bottom: 4px solid var(--accent);
    background: rgba(0, 0, 0, 0.6);
    margin-bottom: 20px;
    letter-spacing: 4px;
    text-shadow: 0 0 10px var(--gold);
}

.layout {
    display: grid;
    grid-template-columns: 350px 500px 350px; 
    gap: 30px;
    padding: 20px;
    justify-content: center;
    max-width: 1300px; 
    width: 100%;
}

.panel {
    background: var(--panel-bg);
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.7), inset 0 0 20px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    border: 2px solid var(--border-color);
    overflow: hidden;
    backdrop-filter: blur(5px);
}

.inventory-panel, .character-panel, .stats-panel {
    height: 850px;
}

h2 { font-size: 28px; margin: 0 0 15px 0; color: var(--highlight); text-transform: uppercase; letter-spacing: 2px; text-shadow: 2px 2px 4px black; }

#inventory-container {
    flex-grow: 1;
    overflow-y: auto;
    margin-top: 15px;
    padding-right: 10px;
}

#inventory-container::-webkit-scrollbar, .fav-list::-webkit-scrollbar, .display-content::-webkit-scrollbar, .hunt-list::-webkit-scrollbar { width: 8px; }
#inventory-container::-webkit-scrollbar-thumb, .fav-list::-webkit-scrollbar-thumb, .display-content::-webkit-scrollbar-thumb, .hunt-list::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 4px; }

.inventory-item {
    background: rgba(0, 0, 0, 0.4);
    padding: 18px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    margin-bottom: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.inventory-item:hover {
    border-color: var(--highlight);
    background: rgba(120, 53, 15, 0.4);
    transform: translateX(8px);
    box-shadow: -5px 0 15px var(--accent);
}

.fav-star {
    font-size: 20px;
    color: #4b5563; /* Gray */
    transition: transform 0.2s, color 0.2s;
    cursor: pointer;
    padding: 5px;
}

.fav-star:hover {
    transform: scale(1.3);
}

.fav-star.active {
    color: var(--gold);
    text-shadow: 0 0 8px var(--gold);
}

.gem-item {
    background: rgba(0,0,0,0.5);
    padding: 10px;
    border-radius: 4px;
    border: 1px dashed var(--gold);
    margin-bottom: 8px;
    cursor: pointer;
    font-size: 13px;
    width: 100%;
    transition: 0.2s;
}

.gem-item:hover { background: var(--accent); color: white; }

.socket-container {
    background: rgba(0,0,0,0.6);
    padding: 15px;
    border-radius: 8px;
    border: 2px solid var(--gold);
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
    max-height: 250px; 
}

.gem-scroll-area {
    overflow-y: auto;
    padding-right: 5px;
}

.gem-scroll-area::-webkit-scrollbar { width: 6px; }
.gem-scroll-area::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 3px; }

.socket-title { color: var(--highlight); font-size: 14px; font-weight: bold; width: 100%; margin-bottom: 5px; text-transform: uppercase; border-bottom: 1px solid var(--accent); padding-bottom: 5px;}

.unequip-btn {
    background: #450a0a;
    border: 2px solid #ef4444;
    color: #fecaca;
    padding: 15px;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 20px;
    text-align: center;
    font-weight: bold;
    font-size: 16px;
    text-transform: uppercase;
    transition: 0.2s;
}
.unequip-btn:hover { background: #7f1d1d; box-shadow: 0 0 15px #ef4444; }

.unequip-all-btn {
    background: #b91c1c;
    border: 2px solid #f87171;
    color: white;
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 15px;
    text-align: center;
    font-weight: bold;
    font-size: 14px;
    text-transform: uppercase;
    transition: 0.2s;
}
.unequip-all-btn:hover { background: #dc2626; box-shadow: 0 0 10px #f87171; }

.back-btn {
    background: var(--gem-slot);
    border: 1px solid var(--highlight);
    color: var(--highlight);
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 15px;
    text-align: center;
    font-size: 14px;
    transition: 0.2s;
}
.back-btn:hover { background: var(--accent); color: white; }

.character {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle, rgba(180, 83, 9, 0.2) 0%, rgba(0,0,0,0.5) 100%);
    width: 100%;
    height: 100%;
    border-radius: 8px;
}

.character img { max-height: 650px; pointer-events: none; z-index: 1; max-width: 90%; filter: drop-shadow(0 0 20px rgba(0,0,0,0.8)); }

.slot {
    width: 90px;
    height: 90px;
    background: rgba(15, 10, 5, 0.85);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    position: absolute;
    cursor: pointer;
    z-index: 5;
    transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: center;
    color: #a8a29e;
    padding: 5px;
    transform: translate(-50%, -50%); 
}

.slot:hover { 
    border-color: var(--highlight); 
    color: #fff; 
    background: var(--accent); 
    box-shadow: 0 0 20px var(--highlight);
}

.slot.selected { 
    border-color: var(--highlight); 
    box-shadow: 0 0 30px var(--gold); 
    transform: translate(-50%, -50%) scale(1.1); 
    z-index: 10;
    background: rgba(180, 83, 9, 0.6);
}

.filled { 
    border-color: var(--gold); 
    background: rgba(69, 26, 3, 0.8); 
    color: #fff; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.6); 
}

.locked { opacity: 0.3; background: #000 !important; border-color: #222 !important; cursor: not-allowed; pointer-events: none; }

#head    { top: 18%;  left: 50%; }
#neck    { top: 26%; left: 70%; }
#chest   { top: 40%; left: 50%; }
#weapon  { top: 40%; left: 20%;  }
#shield  { top: 40%; left: 80%; }
#hands   { top: 55%; left: 20%;  }
#ring    { top: 55%; left: 80%; }
#legs    { top: 62%; left: 50%; }
#feet    { top: 82%;  left: 50%; }
#trinket { top: 82%; left: 26%; }
#ammo    { top: 82%; left: 74%; }

.stats-panel { overflow-y: auto; }
.stat-section { margin-bottom: 15px; }
.stat-section h3 { color: var(--highlight); font-size: 20px; border-bottom: 2px solid var(--accent); padding-bottom: 5px; margin-bottom: 10px; text-transform: uppercase; }

.stat-row { 
    display: flex; 
    justify-content: space-between; 
    padding: 8px 12px; 
    background: rgba(0,0,0,0.3); 
    margin-bottom: 4px; 
    border-radius: 4px; 
    font-size: 14px; 
    cursor: help; 
    transition: all 0.2s; 
    border: 1px solid transparent;
}

.stat-row:hover { 
    background: rgba(180, 83, 9, 0.3); 
    border-color: var(--accent);
    transform: scale(1.02);
}

.stat-label { color: #d6d3d1; }
.stat-val { font-weight: bold; color: var(--highlight); font-family: 'Courier New', Courier, monospace; }
.val-gold { color: var(--gold) !important; text-shadow: 0 0 5px rgba(245, 158, 11, 0.5); }

/* REORGANIZED GRID FOR SPECIFIC ROW ORDER */
.preset-favourites-container {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(6, 1fr); /* Higher base column count to allow flexible spans */
    gap: 20px;
    margin-top: 20px;
    width: 100%;
    max-width: 1300px;
}

/* ROW 2: PRESETS, ITEM DISPLAY, FAVOURITES */
#preset-anchor { grid-column: span 2; }
#display-anchor { grid-column: span 2; }
#favourites-anchor { grid-column: span 2; }

/* ROW 3: HUNTING LOG, CRAFTING LOG */
#hunt-anchor { grid-column: span 3; }
#craft-anchor { grid-column: span 3; }

/* ROW 4: INFO PANEL */
.info-container { grid-column: span 6; }

.bottom-panel {
    background: var(--panel-bg);
    border-radius: 8px;
    padding: 20px;
    border: 2px solid var(--border-color);
    box-shadow: 0 10px 40px rgba(0,0,0,0.7);
    height: 550px; 
    display: flex;
    flex-direction: column;
    min-width: 0; 
}

.preset-table {
    width: 100%;
    border-collapse: collapse;
}

.preset-table td {
    padding: 8px;
    border: 1px solid var(--border-color);
    background: rgba(0,0,0,0.3);
}

.preset-input {
    background: rgba(0,0,0,0.5);
    border: 1px solid var(--accent);
    color: var(--highlight);
    padding: 6px;
    width: 100%;
    font-family: inherit;
    font-size: 12px;
}

.preset-btn {
    padding: 6px 10px;
    cursor: pointer;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 11px;
    border-radius: 4px;
    width: 100%;
}

.btn-save { background: #166534; color: #bbf7d0; border: 1px solid #22c55e; }
.btn-save:hover { background: #15803d; }
.btn-load { background: #1e3a8a; color: #bfdbfe; border: 1px solid #3b82f6; }
.btn-load:hover { background: #1e40af; }

.fav-list {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.fav-item {
    background: rgba(0,0,0,0.4);
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.fav-item:hover {
    border-color: var(--gold);
}

/* HUNTING LOG STYLES */
.hunt-list {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hunt-entry {
    background: rgba(127, 29, 29, 0.2);
    border: 1px solid #ef4444;
    padding: 10px;
    border-radius: 4px;
}

.hunt-enemy { color: #fca5a5; font-weight: bold; font-size: 14px; }
.hunt-loc { color: #fecaca; font-size: 11px; font-style: italic; margin-top: 2px; }
.hunt-item-ref { color: var(--highlight); font-size: 10px; text-transform: uppercase; margin-top: 4px; opacity: 0.8; }

/* CRAFTING LOG STYLES */
.craft-entry {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid #10b981;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 8px;
}
.craft-ingredients { color: #a7f3d0; font-size: 12px; font-weight: bold; margin-bottom: 2px; }
.craft-details { color: #6ee7b7; font-size: 10px; margin-top: 2px; }

/* NEW DISPLAY TABLE STYLES */
.display-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
    background: rgba(0,0,0,0.3);
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.display-title {
    font-size: 22px;
    color: var(--highlight);
    margin-bottom: 10px;
    border-bottom: 1px solid var(--accent);
    padding-bottom: 5px;
}

.display-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(120, 53, 15, 0.3);
}

.display-label { color: #d97706; font-weight: bold; }
.display-val { color: #fff; }

/* INFO WINDOW STYLES */
.info-container {
    margin-top: 30px;
    width: 100%;
}

.info-panel {
    background: rgba(15, 23, 42, 0.9);
    border: 2px solid var(--gold);
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 0 30px rgba(0,0,0,0.8);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.info-card {
    background: rgba(120, 53, 15, 0.1);
    border: 1px solid var(--border-color);
    padding: 15px;
    border-radius: 6px;
}

.info-card h4 {
    margin: 0 0 10px 0;
    color: var(--highlight);
    text-transform: uppercase;
    font-size: 16px;
    border-bottom: 1px solid var(--accent);
    padding-bottom: 5px;
}

.info-card p {
    font-size: 13px;
    line-height: 1.6;
    margin: 0;
    color: #e2e8f0;
}

.display-source-box {
    margin-top: 12px;
    padding: 8px;
    border-radius: 4px;
    font-size: 13px;
}

.display-drop-header {
    background: rgba(127, 29, 29, 0.6);
    color: #fca5a5;
    border: 1px solid #ef4444;
    padding: 4px 8px;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 1px; margin-bottom: 4px;
}

.display-vendor-header {
    background: rgba(30, 58, 138, 0.6);
    color: #bfdbfe;
    border: 1px solid #3b82f6;
    padding: 4px 8px;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 1px;
    margin-bottom: 4px;
    margin-top: 8px;
}

/* PHONE FRIENDLY COLLAPSE STYLES */
.collapsible-header {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.collapsible-header:hover {
    opacity: 0.8;
}
.collapse-icon {
    font-family: monospace;
    font-size: 24px;
    color: var(--gold);
}
.collapsible-content {
    transition: max-height 0.3s ease-out, opacity 0.2s;
    overflow: hidden;
}
.collapsed .collapsible-content {
    max-height: 0 !important;
    opacity: 0;
    pointer-events: none;
}
.collapsed .collapse-icon::before {
    content: "[+]";
}
.collapse-icon::before {
    content: "[-]";
}

@media (max-width: 1200px) {
    .mobile-nav {
        display: block; 
    }
    .layout {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
        padding: 10px;
    }
    .panel {
        width: 100%;
        max-width: 550px;
        height: auto !important;
        scroll-margin-top: 60px;
    }
    .preset-favourites-container {
        display: flex;
        flex-direction: column;
        max-width: 550px;
    }
    .bottom-panel {
        scroll-margin-top: 60px;
        height: auto !important;
        min-height: 0 !important;
        padding: 15px;
    }
    .character-panel { 
        order: 1; 
        height: 700px !important;
    }
    .inventory-panel { order: 2; min-height: 400px; }
    .stats-panel { order: 3; }
    .preset-favourites-container { order: 4; }
    .character img { max-height: 500px; }
    .slot { width: 80px; height: 80px; font-size: 10px; }
}
