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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 3em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    font-size: 1.2em;
    opacity: 0.9;
}

.game-area {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.main-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.canvas-panel, .stats-panel {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.2em;
    border-bottom: 2px solid #667eea;
    padding-bottom: 8px;
}

#gameCanvas {
    display: block;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 15px;
    background: #f8f9fa;
}

#rewardChart {
    display: block;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #f8f9fa;
    margin-top: 15px;
}

.controls {
    display: flex;
    gap: 10px;
}

.btn-primary, .btn-secondary, .btn-test {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #48bb78;
    color: white;
}

.btn-primary:hover {
    background: #38a169;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

.btn-test {
    background: #667eea;
    color: white;
}

.btn-test:hover {
    background: #5568d3;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 15px;
}

.stat-item {
    padding: 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e8f5e9 100%);
    border-radius: 8px;
    text-align: center;
}

.stat-label {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.8em;
    font-weight: bold;
    color: #48bb78;
}

.control-panel {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    overflow-y: auto;
    max-height: 900px;
}

.env-section, .algo-section, .param-section, .reward-section, .policy-section {
    margin-bottom: 20px;
}

.env-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.env-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
}

.env-btn:hover {
    background: #e8f5e9;
    border-color: #48bb78;
}

.env-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.env-icon {
    font-size: 2em;
}

.env-info {
    flex: 1;
}

.env-name {
    font-weight: 600;
    margin-bottom: 3px;
}

.env-desc {
    font-size: 0.85em;
    opacity: 0.8;
}

.select-box {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    background: white;
    cursor: pointer;
}

.select-box:focus {
    outline: none;
    border-color: #667eea;
}

.param-item {
    margin-bottom: 15px;
}

.param-item label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.param-item input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e0e0e0;
    outline: none;
}

.param-item input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

.reward-config {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.reward-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.reward-item label {
    font-weight: 500;
    color: #333;
}

.reward-input {
    width: 80px;
    padding: 8px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    text-align: center;
    font-size: 1em;
}

.reward-input:focus {
    outline: none;
    border-color: #667eea;
}

.policy-display {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    min-height: 100px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    line-height: 1.6;
    color: #333;
}

.tutorial {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.concepts, .algorithms, .rlhf-info, .tips {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.concepts {
    background: #e8f5e9;
    border-left: 4px solid #48bb78;
}

.algorithms {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
}

.rlhf-info {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
}

.tips {
    background: #f3e5f5;
    border-left: 4px solid #9c27b0;
}

.concepts h4, .algorithms h4, .rlhf-info h4, .tips h4 {
    margin-bottom: 10px;
    font-size: 1.1em;
}

.concepts h4 {
    color: #2f855a;
}

.algorithms h4 {
    color: #1976d2;
}

.rlhf-info h4 {
    color: #856404;
}

.tips h4 {
    color: #7b1fa2;
}

.concepts p, .algorithms p, .rlhf-info p {
    margin: 5px 0;
    font-size: 0.9em;
    line-height: 1.6;
}

.rlhf-info ul, .tips ul {
    margin-left: 20px;
    margin-top: 10px;
}

.rlhf-info li, .tips li {
    margin: 5px 0;
    font-size: 0.9em;
    line-height: 1.6;
}

@media (max-width: 1200px) {
    .game-area {
        grid-template-columns: 1fr;
    }
    
    .stat-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
