* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', monospace;
    background-color: #1a1a1a;
    color: #e0e0e0;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.main-content {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

/* Left Navigation */
.left-nav {
    min-width: 150px;
    max-width: 200px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px;
    background-color: #2a2a2a;
    border: 2px solid #444;
    border-radius: 8px;
    align-self: flex-start;
}

.left-nav .btn {
    width: 100%;
    text-align: center;
}

.left-nav:empty {
    display: none;
}

.game-area {
    flex: 1;
    min-width: 0; /* Allows flex item to shrink below content size */
    background-color: #2a2a2a;
    border: 2px solid #444;
    border-radius: 8px;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 2px solid #444;
    padding-bottom: 20px;
}

h1 {
    color: #4a9eff;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}


.status-panel {
    background-color: #1e1e1e;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    border: 1px solid #444;
}

.stat-display {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 15px;
}

.stat-item {
    display: flex;
    gap: 10px;
    font-size: 1.1em;
}

.stat-label {
    color: #888;
    font-weight: bold;
}

#exp-display,
#level-display,
#hp-display {
    color: #4a9eff;
    font-weight: bold;
}

.game-view {
    margin-bottom: 20px;
}

.area-display {
    background-color: #1e1e1e;
    padding: 20px;
    border-radius: 5px;
    margin-bottom: 15px;
    border: 1px solid #444;
    min-height: 100px;
}

#area-name {
    font-size: 1.3em;
    color: #4a9eff;
    margin-bottom: 10px;
    font-weight: bold;
}

#game-status {
    font-size: 1em;
    color: #ccc;
}

.combat-log-container {
    background-color: #1e1e1e;
    border-radius: 5px;
    border: 1px solid #444;
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #444;
    background-color: #252525;
}

.log-header span:first-child {
    color: #888;
    font-size: 0.9em;
    font-weight: bold;
}

.filter-btn {
    background: none;
    border: none;
    color: #4a9eff;
    font-size: 1.2em;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.filter-btn:hover {
    background-color: #333;
}

.filter-btn.filtered {
    opacity: 0.6;
}

.combat-log {
    padding: 15px;
    min-height: 150px;
    max-height: 200px;
    overflow-y: auto;
    font-size: 0.9em;
    color: #aaa;
}

.combat-log .log-entry {
    margin-bottom: 5px;
    padding: 3px 0;
}

.combat-log .log-entry:last-child {
    margin-bottom: 0;
}

.log-cursor {
    color: #4a9eff;
    font-weight: bold;
    animation: blink 1s infinite;
    margin-top: 2px;
}

@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

.action-panel {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    background-color: #4a9eff;
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 1em;
    font-family: 'Courier New', monospace;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn:hover:not(:disabled) {
    background-color: #3a8eef;
}

.btn:disabled {
    background-color: #555;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Scrollbar styling */
.combat-log::-webkit-scrollbar {
    width: 8px;
}

.combat-log::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.combat-log::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

.combat-log::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ASCII Art styling */
.ascii-art {
    font-family: 'Courier New', monospace;
    font-size: 1.35em;
    line-height: 1.1;
    text-align: center;
    margin: 15px 0;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.1em;
    background-color: #0a0a0a;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #333;
}

.map-line {
    display: block;
    white-space: nowrap;
}

/* Map character colors */
.player-char {
    color: #4a9eff;
    font-weight: bold;
}

.enemy-char {
    color: #d32f2f;
    font-weight: bold;
}

.tree-char {
    color: #2d5016;
}

.rock-char {
    color: #666;
}

.ground-char {
    color: #333;
}

/* Modal styling */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: #2a2a2a;
    margin: 10% auto;
    padding: 30px;
    border: 2px solid #4a9eff;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.modal-content h2 {
    color: #4a9eff;
    margin-bottom: 15px;
    text-align: center;
}

.modal-content p {
    color: #ccc;
    margin-bottom: 20px;
    text-align: center;
}

.modal-content input[type="text"] {
    width: 100%;
    padding: 12px;
    font-family: 'Courier New', monospace;
    font-size: 1em;
    background-color: #1e1e1e;
    color: #e0e0e0;
    border: 1px solid #444;
    border-radius: 5px;
    margin-bottom: 20px;
}

.modal-content input[type="text"]:focus {
    outline: none;
    border-color: #4a9eff;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
}

#stats-display-content {
    color: #ccc;
    line-height: 2;
    margin-bottom: 20px;
}

#stats-display-content .stat-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #333;
}

#stats-display-content .stat-row:last-child {
    border-bottom: none;
}

#stats-display-content .stat-name {
    color: #888;
}

#stats-display-content .stat-value {
    color: #4a9eff;
    font-weight: bold;
}

.stat-bonus {
    color: #4aff4a;
    font-size: 0.9em;
    margin-left: 8px;
}

/* Stat Allocation Modal */
.stat-points-display {
    color: #4a9eff;
    font-weight: bold;
    font-size: 1.2em;
}

.stat-allocation-grid {
    margin: 20px 0;
}

.stat-allocation-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #333;
}

.stat-allocation-row:last-child {
    border-bottom: none;
}

.stat-allocation-label {
    color: #888;
    font-weight: bold;
    min-width: 80px;
}

.stat-allocation-value {
    color: #4a9eff;
    font-weight: bold;
    min-width: 50px;
    text-align: center;
}

.stat-allocation-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-btn {
    background-color: #4a9eff;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    font-size: 1.2em;
    font-family: 'Courier New', monospace;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.stat-btn:hover:not(:disabled) {
    background-color: #3a8eef;
}

.stat-btn:disabled {
    background-color: #555;
    cursor: not-allowed;
    opacity: 0.5;
}

.stat-allocation-allocated {
    color: #4a9eff;
    font-weight: bold;
    min-width: 30px;
    text-align: center;
}

/* Game Over Modal */
.game-over-content {
    text-align: center;
}

.game-over-text {
    color: #ccc;
    font-size: 1.1em;
    margin: 15px 0;
    line-height: 1.8;
    animation: fadeIn 1s ease-in;
}

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

/* Dead map overlay effect */
.map-dead {
    opacity: 0.3;
    filter: grayscale(100%);
    transition: opacity 0.5s, filter 0.5s;
}

/* Campfire Animation */
.campfire-flame {
    color: #ff6b35;
    animation: flicker 0.5s infinite;
}

.campfire-smoke {
    color: #888;
}

.campfire-wood {
    color: #8b4513;
}

/* Log Book Styles */
.log-book-content {
    max-height: 400px;
    overflow-y: auto;
    padding: 10px 0;
}

.log-book-empty {
    text-align: center;
    color: #888;
    font-style: italic;
    padding: 20px;
}

.log-book-entry {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #252525;
    border-radius: 5px;
    border-left: 3px solid #4a9eff;
}

.log-book-entry:last-child {
    margin-bottom: 0;
}

.log-book-entry-title {
    color: #4a9eff;
    margin: 0 0 10px 0;
    font-size: 1.2em;
}

.log-book-entry-text {
    color: #aaa;
    margin: 0;
    line-height: 1.6;
}

/* Inventory Styles */
.inventory-content {
    max-width: 800px;
}

.inventory-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

.equipment-slots h3,
.inventory-items h3 {
    color: #4a9eff;
    margin: 0 0 15px 0;
    font-size: 1.1em;
}

.equipment-slot {
    background-color: #252525;
    border: 2px solid #444;
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 10px;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.equipment-slot:last-child {
    margin-bottom: 0;
}

.slot-label {
    color: #888;
    font-size: 0.9em;
    margin-bottom: 8px;
    font-weight: bold;
}

.slot-item {
    color: #aaa;
    font-size: 0.95em;
    min-height: 20px;
}

.slot-item.equipped {
    color: #4a9eff;
    cursor: pointer;
}

.slot-item.equipped:hover {
    color: #3a8eef;
    text-decoration: underline;
}

.inventory-items-list {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.inventory-item {
    background-color: #252525;
    border: 2px solid #444;
    border-radius: 5px;
    padding: 12px;
    cursor: pointer;
    transition: border-color 0.3s, background-color 0.3s;
}

.inventory-item:hover:not(.disabled) {
    border-color: #4a9eff;
    background-color: #2a2a2a;
}

.inventory-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: #666;
}

.inventory-item-name {
    color: #4a9eff;
    font-weight: bold;
    margin-bottom: 5px;
}

.inventory-item-type {
    color: #888;
    font-size: 0.85em;
    margin-bottom: 5px;
}

.inventory-item-stats {
    color: #aaa;
    font-size: 0.9em;
    margin-top: 5px;
}

.inventory-item-damage {
    color: #ff6b35;
    font-size: 0.9em;
    margin-top: 5px;
    font-weight: bold;
}

.inventory-item-requirement {
    color: #ff6b35;
    font-size: 0.85em;
    margin-top: 5px;
    font-style: italic;
}

.inventory-item-stat {
    margin: 2px 0;
}

.inventory-empty {
    text-align: center;
    color: #888;
    font-style: italic;
    padding: 20px;
}

/* Goblin Merchant Styles */
.goblin-art {
    font-family: 'Courier New', monospace;
    white-space: pre;
    text-align: center;
    line-height: 1.2;
    color: #4aff4a;
    margin: 20px 0;
    font-size: 0.9em;
}

.merchant-content {
    max-width: 900px;
}

.merchant-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

.merchant-shop h3,
.merchant-sell h3 {
    color: #4a9eff;
    margin: 0 0 15px 0;
    font-size: 1.1em;
}

.merchant-items-list {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.merchant-item {
    background-color: #252525;
    border: 2px solid #444;
    border-radius: 5px;
    padding: 12px;
    transition: border-color 0.3s, background-color 0.3s;
}

.merchant-item:hover:not(.disabled) {
    border-color: #4a9eff;
    background-color: #2a2a2a;
}

.merchant-item.disabled {
    opacity: 0.5;
    border-color: #666;
}

.merchant-item-name {
    color: #4a9eff;
    font-weight: bold;
    margin-bottom: 5px;
}

.merchant-item-type {
    color: #888;
    font-size: 0.85em;
    margin-bottom: 5px;
}

.merchant-item-stats {
    color: #aaa;
    font-size: 0.9em;
    margin-top: 5px;
}

.merchant-item-damage {
    color: #ff6b35;
    font-size: 0.9em;
    margin-top: 5px;
    font-weight: bold;
}

.merchant-item-price {
    color: #ffd700;
    font-weight: bold;
    margin: 8px 0;
    font-size: 1.1em;
}

.merchant-buy-btn,
.merchant-sell-btn {
    margin-top: 8px;
    width: 100%;
}

.merchant-empty {
    text-align: center;
    color: #888;
    font-style: italic;
    padding: 20px;
}

@keyframes flicker {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Debug Panel Styling */
.debug-panel {
    background-color: #2a2a2a;
    border: 2px solid #666;
    border-radius: 8px;
    padding: 15px;
    min-width: 200px;
    max-width: 250px;
    flex-shrink: 0;
}

.debug-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #444;
}

.debug-header h3 {
    color: #888;
    font-size: 0.9em;
    margin: 0;
    font-weight: normal;
}

.debug-toggle {
    background: none;
    border: none;
    color: #888;
    font-size: 1.2em;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
    font-family: 'Courier New', monospace;
}

.debug-toggle:hover {
    color: #ccc;
}

.debug-content {
    display: block;
}

.debug-panel.collapsed .debug-content {
    display: none;
}

.debug-panel.collapsed {
    min-width: auto;
    max-width: 150px;
}

.debug-panel.collapsed .debug-header h3 {
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

.btn-danger {
    background-color: #d32f2f;
    width: 100%;
    margin-bottom: 15px;
}

.btn-danger:hover:not(:disabled) {
    background-color: #b71c1c;
}

.debug-info {
    font-size: 0.85em;
    color: #aaa;
}

.debug-stat {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid #333;
}

.debug-stat:last-child {
    border-bottom: none;
}

.debug-stat span:last-child {
    color: #4a9eff;
    font-weight: bold;
}

.debug-logs {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #444;
}

.debug-logs h4 {
    color: #888;
    font-size: 0.85em;
    margin-bottom: 10px;
    font-weight: normal;
}

.debug-log-content {
    background-color: #1e1e1e;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 10px;
    max-height: 200px;
    overflow-y: auto;
    font-size: 0.75em;
    color: #aaa;
    line-height: 1.4;
}

.debug-log-entry {
    margin-bottom: 4px;
    padding: 2px 0;
    word-wrap: break-word;
}

.debug-log-entry:last-child {
    margin-bottom: 0;
}

.debug-log-entry .timestamp {
    color: #666;
    margin-right: 5px;
}

/* Scrollbar for debug logs */
.debug-log-content::-webkit-scrollbar {
    width: 6px;
}

.debug-log-content::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.debug-log-content::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}

.debug-log-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Hide debug panel on smaller screens or when needed */
@media (max-width: 900px) {
    .debug-panel {
        display: none;
    }
    
    .left-nav {
        min-width: 120px;
        max-width: 150px;
    }
}

/* To completely hide debug panel, uncomment this:
.debug-panel {
    display: none !important;
}
*/

