@font-face {
    font-family: 'PrintChar21';
    src: url('fonts/pr/PrintChar21.ttf') format('truetype');
}

body, html {
    height: 100%;
    margin: 0;
    padding: 0;
    background-color: black;
    font-size: 10px;
    color: rgb(146, 146, 146);
    font-family: 'PrintChar21', monospace;
}

body {
    overflow: auto; /* Add scrollbars to the body if content overflows */
}

.controls {
    display: flex;
    gap: 20px;
    padding: 15px;
    background-color: #0a0a0a;
    border-bottom: 1px solid rgb(146, 146, 146);
    align-items: center;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 5px;
}

label {
    font-size: 12px;
    color: rgb(146, 146, 146);
}

input[type="number"] {
    background-color: #1a1a1a;
    color: rgb(146, 146, 146);
    border: 1px solid rgb(146, 146, 146);
    padding: 4px 8px;
    font-family: 'PrintChar21', monospace;
    font-size: 12px;
    width: 60px;
}

select {
    background-color: #1a1a1a;
    color: rgb(146, 146, 146);
    border: 1px solid rgb(146, 146, 146);
    padding: 4px 8px;
    font-family: 'PrintChar21', monospace;
    font-size: 12px;
    cursor: pointer;
    min-width: 120px;
}

select:hover {
    background-color: #2a2a2a;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 150px;
    height: 6px;
    background: #1a1a1a;
    border: 1px solid rgb(146, 146, 146);
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: rgb(200, 100, 255);
    border: 1px solid rgb(146, 146, 146);
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: rgb(200, 100, 255);
    border: 1px solid rgb(146, 146, 146);
    cursor: pointer;
}

#aiSpeedValue {
    font-size: 11px;
    color: rgb(200, 100, 255);
    min-width: 45px;
    display: inline-block;
}

input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background-color: #1a1a1a;
    border: 1px solid rgb(0, 200, 200);
    cursor: pointer;
    position: relative;
    margin: 0;
}

input[type="checkbox"]:hover {
    background-color: #2a2a2a;
}

input[type="checkbox"]:checked {
    background-color: rgb(0, 200, 200);
}

input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: black;
    font-size: 12px;
    font-weight: bold;
}

button {
    background-color: #1a1a1a;
    color: rgb(146, 146, 146);
    border: 1px solid rgb(146, 146, 146);
    padding: 6px 12px;
    font-family: 'PrintChar21', monospace;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #2a2a2a;
}

button:active {
    background-color: #0a0a0a;
}

button.primary-btn {
    border-color: rgb(0, 200, 200);
    color: rgb(0, 200, 200);
    font-size: 14px;
    padding: 8px 16px;
    font-weight: bold;
    border-width: 2px;
}

button.primary-btn:hover {
    background-color: rgba(0, 200, 200, 0.15);
    box-shadow: 0 0 10px rgba(0, 200, 200, 0.3);
}

button.tool-carve {
    border-color: rgb(32, 8, 66);
    color: rgb(180, 100, 100);
}

button.tool-build {
    border-color: rgb(100, 100, 180);
    color: rgb(100, 100, 180);
}

button.brush-size {
    padding: 6px 10px;
    min-width: 45px;
}

button.brush-size.active {
    background-color: rgb(146, 146, 146);
    color: black;
    border-color: rgb(146, 146, 146);
}

.dungeon-tools-row {
    /* Top row - dungeon design tools */
}

.game-starters-row {
    border-top: 1px solid rgb(50, 50, 50);
}

.player-row {
    border-top: 1px solid rgb(50, 50, 50);
}

.high-score-row {
    border-top: 1px solid rgb(50, 50, 50);
    justify-content: space-between;
}

.high-score-display {
    font-size: 16px;
    font-weight: bold;
    color: gold;
    font-family: 'PrintChar21', monospace;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

#highScoreValue {
    font-size: 18px;
}

button.player-btn {
    border-color: rgb(0, 200, 200);
    color: rgb(0, 200, 200);
}

button.player-btn:hover {
    background-color: rgba(0, 200, 200, 0.1);
}

button.player-btn.active {
    background-color: rgb(0, 200, 200);
    color: black;
    border-color: rgb(0, 200, 200);
}

button.play-btn {
    border-color: rgb(0, 200, 0);
    color: rgb(0, 200, 0);
}

button.play-btn:hover {
    background-color: rgba(0, 200, 0, 0.1);
}

button.play-btn.active {
    background-color: rgb(0, 200, 0);
    color: black;
}

button.ai-btn {
    border-color: rgb(200, 100, 255);
    color: rgb(200, 100, 255);
}

button.ai-btn:hover {
    background-color: rgba(200, 100, 255, 0.1);
}

button.ai-btn.active {
    background-color: rgb(200, 100, 255);
    color: black;
}

select.ai-select {
    border-color: rgb(200, 100, 255);
    color: rgb(200, 100, 255);
    min-width: 150px;
}

select.ai-select:hover {
    background-color: rgba(200, 100, 255, 0.1);
}

button.stop-btn {
    border-color: rgb(200, 0, 0);
    color: rgb(200, 0, 0);
}

button.stop-btn:hover {
    background-color: rgba(200, 0, 0, 0.1);
}

button.save-btn {
    border-color: rgb(0, 200, 0);
    color: rgb(0, 200, 0);
}

button.save-btn:hover {
    background-color: rgba(0, 200, 0, 0.1);
}

button.reset-btn {
    border-color: rgb(200, 0, 0);
    color: rgb(200, 0, 0);
    font-size: 10px;
    padding: 4px 8px;
}

button.reset-btn:hover {
    background-color: rgba(200, 0, 0, 0.1);
}

.stats-panel {
    gap: 15px;
}

.hp-bar-container {
    position: relative;
    width: 150px;
    height: 20px;
    border: 1px solid rgb(0, 200, 200);
    background-color: #1a1a1a;
}

.hp-bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background-color: rgb(0, 158, 3);
    transition: width 0.3s ease;
}

.hp-bar-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: rgb(255, 255, 255);
    font-family: 'PrintChar21', monospace;
    pointer-events: none;
    /* text-shadow: 1px 1px 2px black; */
}

.stat-text {
    font-size: 11px;
    color: rgb(15, 192, 211);
    font-family: 'PrintChar21', monospace;
}

.stats-panel div:nth-child(5) {
    color: gold;
}

.new-high-score {
    animation: scoreGlow 1s ease-in-out infinite;
}

@keyframes scoreGlow {
    0%, 100% {
        color: gold;
        text-shadow: 0 0 5px gold;
    }
    50% {
        color: rgb(255, 215, 0);
        text-shadow: 0 0 10px gold, 0 0 20px gold;
    }
}

.game-container {
    display: flex;
    gap: 20px;
    padding: 20px;
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap; /* Allow wrapping for smaller screens */
}

.graphs-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 500px; /* Increased width by another 20% */
}

.graph-wrapper {
    border: 1px solid rgb(146, 146, 146);
    background-color: #0a0a0a;
    padding: 05px;
    display: flex;
    flex-direction: column;
}

.graph-wrapper:first-child {
    height: 300px; /* Taller high score graph */
}

.graph-wrapper:last-child {
    height: 250px; /* Taller events graph */
}

.graph-header {
    display: flex; /* Use flexbox for alignment */
    justify-content: space-between; /* Space between title and button */
    align-items: center; /* Center items vertically */
    padding: 5px;
    background-color: #1a1a1a;
    border-bottom: 1px solid rgb(146, 146, 146);
    font-size: 12px;
    color: rgb(146, 146, 146);
    text-align: center;
    margin-bottom: 10px;
}

#dungeonCanvas {
    border: 1px solid rgb(146, 146, 146);
    cursor: crosshair;
    image-rendering: pixelated;
}

.action-log {
    width: 250px;
    height: 600px;
    border: 1px solid rgb(146, 146, 146);
    background-color: #0a0a0a;
    display: flex;
    flex-direction: column;
}

.log-header {
    padding: 10px;
    background-color: #1a1a1a;
    border-bottom: 1px solid rgb(146, 146, 146);
    font-size: 12px;
    color: rgb(146, 146, 146);
    text-align: center;
}

.log-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    font-size: 11px;
    color: rgb(146, 146, 146);
    font-family: 'PrintChar21', monospace;
}

.log-content::-webkit-scrollbar {
    width: 8px;
}

.log-content::-webkit-scrollbar-track {
    background: #0a0a0a;
}

.log-content::-webkit-scrollbar-thumb {
    background: rgb(146, 146, 146);
}

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

.log-entry.red {
    color: rgb(200, 0, 0);
}

.log-entry.cyan {
    color: rgb(0, 200, 200);
}

.log-entry.yellow {
    color: gold;
}

.log-entry.green {
    color: rgb(0, 200, 0);
}
