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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#game {
    display: block;
    width: 100%;
    height: 100%;
}

#ui {
    position: absolute;
    top: 20px;
    left: 20px;
    color: white;
    font-family: monospace;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

#speed {
    font-size: 24px;
    font-weight: bold;
}

#controls {
    margin-top: 8px;
    font-size: 12px;
    opacity: 0.7;
}

/* RL Debug HUD */
#rl-hud {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(100, 255, 100, 0.4);
    border-radius: 4px;
    padding: 10px 14px;
    color: #aaffaa;
    font-family: monospace;
    font-size: 12px;
    line-height: 1.6;
}

#rl-hud.hidden {
    display: none;
}

#rl-hud .hud-title {
    color: #88ff88;
    font-weight: bold;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(100, 255, 100, 0.3);
    padding-bottom: 4px;
}

#rl-hud .hud-section {
    margin-bottom: 4px;
}

#rl-hud .hud-divider {
    border-top: 1px solid rgba(100, 255, 100, 0.2);
    margin: 8px 0;
}

#rl-hud .speed-label {
    display: block;
    margin-bottom: 4px;
    color: #88ff88;
}

#rl-hud #speed-slider {
    width: 100%;
    cursor: pointer;
    accent-color: #88ff88;
}

#rl-hud #speed-value {
    color: #ffff88;
    font-weight: bold;
}

#hud-epoch, #hud-step, #hud-sps, #hud-return {
    color: #88ccff;
}

#rl-hud .hud-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

#rl-hud .hud-btn {
    background: rgba(100, 255, 100, 0.2);
    color: #88ff88;
    border: 1px solid rgba(100, 255, 100, 0.4);
    padding: 6px 16px;
    font-family: monospace;
    font-size: 12px;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.15s;
}

#rl-hud .hud-btn:hover {
    background: rgba(100, 255, 100, 0.3);
    border-color: rgba(100, 255, 100, 0.6);
}

#rl-hud .hud-btn.running {
    background: rgba(255, 100, 100, 0.2);
    color: #ff8888;
    border-color: rgba(255, 100, 100, 0.4);
}

#rl-hud .hud-btn.running:hover {
    background: rgba(255, 100, 100, 0.3);
}

#train-status {
    color: #888;
    font-size: 11px;
}

#train-status.running {
    color: #88ff88;
}

/* RL Charts */
#rl-charts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chart-container {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chart-label {
    color: #88ff88;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#rl-charts canvas {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(100, 255, 100, 0.3);
    border-radius: 2px;
}

/* Creative Mode Panel */
#creative-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    font-family: monospace;
}

#creative-toggle {
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 10px 20px;
    font-size: 14px;
    font-family: monospace;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

#creative-toggle:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: rgba(255, 255, 255, 0.5);
}

#creative-toggle.active {
    background: rgba(80, 180, 80, 0.8);
    border-color: rgba(100, 255, 100, 0.6);
}

#creative-options {
    display: none;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 12px;
    margin-top: 8px;
    min-width: 160px;
}

#creative-options.visible {
    display: block;
}

.option-group {
    margin-bottom: 12px;
}

.option-group:last-child {
    margin-bottom: 0;
}

.option-group label {
    display: block;
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.category-buttons,
.object-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.category-btn,
.object-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 10px;
    font-size: 11px;
    font-family: monospace;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.15s;
    text-transform: capitalize;
}

.category-btn:hover,
.object-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.category-btn.active {
    background: rgba(100, 180, 255, 0.4);
    border-color: rgba(100, 180, 255, 0.6);
}

.object-btn.active {
    background: rgba(100, 255, 100, 0.4);
    border-color: rgba(100, 255, 100, 0.6);
}

#size-slider {
    width: 100%;
    cursor: pointer;
}

.action-btn {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 12px;
    font-size: 11px;
    font-family: monospace;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.15s;
    margin-right: 4px;
    margin-bottom: 4px;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.action-btn.danger {
    background: rgba(255, 80, 80, 0.3);
    border-color: rgba(255, 80, 80, 0.5);
}

.action-btn.danger:hover {
    background: rgba(255, 80, 80, 0.5);
}

/* Chart Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: rgba(20, 30, 20, 0.95);
    border: 1px solid rgba(100, 255, 100, 0.4);
    border-radius: 8px;
    padding: 16px;
    min-width: 440px;
    font-family: monospace;
    color: #aaffaa;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(100, 255, 100, 0.3);
}

#modal-title {
    color: #88ff88;
    font-weight: bold;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#modal-close {
    background: none;
    border: none;
    color: #88ff88;
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

#modal-close:hover {
    color: #ff8888;
}

#modal-chart {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(100, 255, 100, 0.3);
    border-radius: 4px;
    width: 100%;
}

.modal-stats {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    font-size: 12px;
}

.stat-label {
    color: #888;
}

.modal-stats span:not(.stat-label) {
    color: #88ccff;
    font-weight: bold;
}

/* Make chart containers clickable */
.chart-container {
    cursor: pointer;
    transition: transform 0.1s;
}

.chart-container:hover {
    transform: scale(1.05);
}

.chart-container:hover canvas {
    border-color: rgba(100, 255, 100, 0.6);
}
