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

html {
    box-sizing: border-box;
}

*, *:before, *:after {
    box-sizing: inherit;
}

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

.container {
    width: 95%;
    min-width: 1000px;
    max-width: 1700px;
    margin: 20px auto;
    padding: 30px;
    background-color: rgba(0, 20, 0, 0.5);
    border: 1px solid rgb(0, 158, 0);
}

h1, h2, h3 {
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2px;
}

h1 {
    font-size: 2.2em;
    margin-bottom: 20px;
}

h2 {
    font-size: 1.8em;
    border-bottom: 1px solid rgb(0, 158, 0);
    padding-bottom: 5px;
    margin-bottom: 15px;
}

h3 {
    font-size: 1.4em;
    margin: 10px 0;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    align-items: center;
}

button {
    background-color: black;
    color: rgb(0, 158, 0);
    border: 1px solid rgb(0, 158, 0);
    padding: 8px 16px;
    font-family: 'PrintChar21', monospace;
    cursor: pointer;
    font-size: 1.4em;
    text-transform: uppercase;
}

button:hover {
    background-color: rgb(0, 50, 0);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.round-indicator {
    font-size: 1.4em;
    margin-left: 20px;
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 20px;
    font-size: 1.4em;
}

#simulation-speed {
    width: 120px;
    height: 10px;
    background-color: rgba(0, 50, 0, 0.5);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

#simulation-speed::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background-color: rgb(0, 158, 0);
    cursor: pointer;
    border-radius: 0;
}

#simulation-speed::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background-color: rgb(0, 158, 0);
    cursor: pointer;
    border-radius: 0;
    border: none;
}

.stats-container {
    margin-bottom: 30px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1.4em;
}

th, td {
    border: 1px solid rgb(0, 158, 0);
    padding: 8px;
    text-align: center;
}

th {
    background-color: rgba(0, 50, 0, 0.5);
}

/* Visualization Styles */
.visualizations {
    margin-bottom: 30px;
    width: 100%;
}

.vis-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, auto);
    gap: 20px;
    width: 100%;
}

.vis-section {
    border: 1px solid rgb(0, 158, 0);
    padding: 20px;
    background-color: rgba(0, 10, 0, 0.5);
    width: 100%;
    display: flex;
    flex-direction: column;
}

#stance-section {
    min-height: 300px;
}

#stance-section .stance-charts {
    flex: 1;
    overflow: auto;
}

.chart-container {
    height: 250px;
    position: relative;
}

.stance-charts {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin: 15px 0;
    width: 100%;
}

/* Only use 4 columns when there's enough width */
@media (min-width: 1400px) {
    .stance-charts {
        grid-template-columns: repeat(2, 1fr);
    }
}

.pie-chart-container {
    width: 100%;
    min-width: 0;
    height: 200px;
    padding: 15px;
    border: 1px solid rgb(0, 158, 0);
    background-color: rgba(0, 20, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.pie-chart-container h3 {
    margin-top: 0;
    margin-bottom: 5px;
    font-size: 1.2em;
}

.pie-chart-container canvas {
    flex: 1;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.stat-card {
    border: 1px solid rgb(0, 158, 0);
    padding: 15px;
    background-color: rgba(0, 20, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
}

#win-rate-bars {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rate-bar {
    height: 20px;
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.rate-label {
    width: 50px;
    font-size: 1.2em;
    text-align: right;
    margin-right: 10px;
}

.rate-track {
    flex-grow: 1;
    height: 100%;
    background-color: rgba(0, 40, 0, 0.5);
    position: relative;
}

.rate-fill {
    height: 100%;
    background-color: rgb(0, 158, 0);
}

.rate-value {
    font-size: 1.2em;
    margin-left: 10px;
    min-width: 30px;
}

#match-count, #wl-ratio {
    display: flex;
    justify-content: space-between;
    width: 100%;
}

.count-item, .ratio-item {
    text-align: center;
    flex: 1;
}

.count-value, .ratio-value {
    font-size: 1.6em;
    margin-top: 5px;
}

/* Behavior styles */
.behavior-select {
    background-color: black;
    color: rgb(0, 158, 0);
    border: 1px solid rgb(0, 158, 0);
    padding: 4px 8px;
    font-family: 'PrintChar21', monospace;
    font-size: 1em;
    width: 100%;
    cursor: pointer;
    appearance: none;
    text-align: center;
    text-transform: uppercase;
}

.behavior-select:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 158, 0, 0.5);
}

.behavior-select option {
    background-color: black;
    color: rgb(0, 158, 0);
}

#randomize-btn {
    background-color: rgba(0, 20, 0, 0.5);
    color: rgb(0, 158, 0);
    border: 1px solid rgb(0, 158, 0);
    padding: 8px 16px;
    font-family: 'PrintChar21', monospace;
    cursor: pointer;
    font-size: 1.4em;
    text-transform: uppercase;
    margin-left: 20px;
}

#randomize-btn:hover {
    background-color: rgba(0, 50, 0, 0.8);
}

.chart-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

.chart-controls button {
    background-color: rgba(0, 20, 0, 0.5);
    font-size: 1.2em;
    padding: 6px 12px;
}

.chart-controls button.active {
    background-color: rgba(0, 80, 0, 0.8);
}