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

body {
    background-color: #ffffff;
    color: #000000;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    padding: 10px;
    overflow-x: hidden;
}

#container {
    max-width: 900px;
    margin: 0 auto;
    overflow-x: hidden;
}

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

header h1 {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 5px;
    word-spacing: 2px;
}

header p {
    font-size: 12px;
    font-style: italic;
}

#main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.panel {
    border: 1px solid #000;
    padding: 12px;
    background-color: #ffffff;
}

.panel h3 {
    margin-bottom: 10px;
    border-bottom: 1px dotted #000;
    padding-bottom: 5px;
    font-weight: bold;
    font-size: 13px;
}

/* Status Panel */
#status-panel {
    background-color: #f9f9f9;
    border: 2px solid #000;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.stat-label {
    font-weight: bold;
}

.stat-value {
    text-align: right;
    min-width: 100px;
}

/* Scene Content */
#scene-content {
    white-space: pre-wrap;
    word-break: break-all;
    font-size: 12px;
    line-height: 1.4;
}

/* Log Panel */
#log-panel {
    max-height: 150px;
    overflow-y: auto;
}

#game-log {
    font-size: 12px;
}

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

.log-important {
    font-weight: bold;
}

.log-quest {
    color: #000;
    font-weight: bold;
}

.log-reward {
    color: #000;
    font-style: italic;
}

/* Action Buttons */
#action-buttons {
    margin-bottom: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

#quick-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    background-color: #ffffff;
    border: 1px solid #000;
    padding: 6px 12px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    cursor: pointer;
    min-width: 100px;
}

.action-btn:hover {
    background-color: #f0f0f0;
    font-weight: bold;
}

.action-btn:active {
    background-color: #e0e0e0;
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Inventory */
#inventory-items {
    font-size: 12px;
}

.inventory-item {
    margin-bottom: 5px;
    padding-left: 5px;
}

.item-name {
    font-weight: bold;
}

.item-count {
    float: right;
}

/* Upgrades */
#upgrades-list {
    font-size: 12px;
}

.upgrade-item {
    margin-bottom: 8px;
    padding: 5px;
    border-left: 2px solid #000;
    padding-left: 8px;
}

.upgrade-name {
    font-weight: bold;
}

.upgrade-cost {
    font-size: 11px;
    color: #000;
}

.upgrade-btn {
    background-color: #ffffff;
    border: 1px solid #000;
    padding: 3px 8px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    cursor: pointer;
    margin-left: 5px;
}

.upgrade-btn:hover:not(:disabled) {
    background-color: #f0f0f0;
}

.upgrade-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.upgrade-purchased {
    opacity: 0.6;
}

/* Settings */
.settings-btn {
    background-color: #ffffff;
    border: 1px solid #000;
    padding: 6px 12px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    cursor: pointer;
    margin-right: 8px;
    margin-bottom: 8px;
}

.settings-btn:hover {
    background-color: #f0f0f0;
}

/* Footer */
footer {
    text-align: center;
    border-top: 2px solid #000;
    padding-top: 10px;
    font-size: 11px;
    color: #666;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f0f0f0;
}

::-webkit-scrollbar-thumb {
    background: #000;
}

::-webkit-scrollbar-thumb:hover {
    background: #333;
}

/* Monster Select Panel & Viewport */
#monster-select-panel {
    font-size: 12px;
}

#monster-select-panel select {
    background-color: #ffffff;
    border: 1px solid #000;
    padding: 4px 8px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    cursor: pointer;
    margin-bottom: 5px;
}

#monster-select-panel select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Fixed combat viewport - prevents page shift */
#combat-display {
    min-height: 250px !important;
    overflow: hidden;
}

/* Clickable map elements */
.clickable {
    cursor: pointer;
    text-decoration: underline;
    color: #000;
    font-weight: bold;
}

.clickable:hover {
    color: #008000;
    background-color: #ffffcc;
}

.locked {
    color: #999999;
    font-style: italic;
}

/* Responsive */
@media (max-width: 600px) {
    body {
        font-size: 12px;
        padding: 5px;
        overflow-x: hidden;
    }

    #container {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    #main {
        gap: 8px;
    }

    header h1 {
        font-size: 18px;
    }

    #action-buttons,
    #quick-actions {
        gap: 5px;
        flex-wrap: wrap;
    }

    .action-btn {
        padding: 5px 8px;
        font-size: 11px;
        min-width: 70px;
    }

    /* ASCII art: shrink font and allow horizontal scroll within the element only */
    pre, #asciiMap {
        font-size: 7px !important;
        line-height: 1.1;
        overflow-x: auto;
        max-width: 100%;
        white-space: pre;
    }

    /* Village square icon map */
    div[style*="white-space: pre-wrap"][style*="font-size: 12px"] {
        font-size: 9px !important;
    }

    .panel {
        padding: 8px;
    }

    .panel h2, .panel h3 {
        font-size: 12px;
    }
}

/* Dark Mode */
body.dark-mode {
    background-color: #000000;
    color: #ffffff;
}

body.dark-mode .panel {
    background-color: #111111;
    border-color: #ffffff;
}

body.dark-mode #status-panel {
    background-color: #111111;
    border-color: #ffffff;
}

body.dark-mode .action-btn,
body.dark-mode .settings-btn,
body.dark-mode .upgrade-btn {
    background-color: #111111;
    color: #ffffff;
    border-color: #ffffff;
}

body.dark-mode .action-btn:hover,
body.dark-mode .settings-btn:hover,
body.dark-mode .upgrade-btn:hover:not(:disabled) {
    background-color: #222222;
}

body.dark-mode .upgrade-item {
    border-left-color: #ffffff;
}

body.dark-mode .upgrade-cost {
    color: #cccccc;
}

body.dark-mode .clickable {
    color: #ffffff;
}

body.dark-mode .clickable:hover {
    color: #ffff66;
    background-color: #333300;
}

body.dark-mode .locked {
    color: #666666;
}

body.dark-mode #monster-select-panel select {
    background-color: #111111;
    color: #ffffff;
    border-color: #ffffff;
}

body.dark-mode ::-webkit-scrollbar-track {
    background: #222222;
}

body.dark-mode ::-webkit-scrollbar-thumb {
    background: #ffffff;
}

body.dark-mode header {
    border-bottom-color: #ffffff;
}

body.dark-mode footer {
    border-top-color: #ffffff;
    color: #999999;
}

body.dark-mode #buffChoices {
    background: #111111;
    border-color: #ffd700;
    color: #ffffff;
}

body.dark-mode #colosseum-buffs-display {
    background: #111111;
    border-color: #ffffff;
}