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

body {
    font-family: 'Courier New', monospace;
    background: #1a1a2e;
    color: #e0e0e0;
    overflow: hidden;
}

/* ── Configuration Screen ── */
#config-screen {
    position: fixed;
    inset: 0;
    background: #1a1a2e;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
}

.config-container {
    max-width: 700px;
    width: 90%;
    padding: 40px;
}

.config-title {
    font-size: 36px;
    color: #e94560;
    text-shadow: 0 0 20px rgba(233, 69, 96, 0.5);
    text-align: center;
    margin-bottom: 4px;
}

.config-subtitle {
    text-align: center;
    color: #888;
    font-size: 14px;
    margin-bottom: 30px;
}

.config-sections {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
}

.config-section {
    background: rgba(22, 33, 62, 0.95);
    border: 1px solid #0f3460;
    border-radius: 8px;
    padding: 16px;
}

.config-section h3 {
    color: #e94560;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 12px;
}

.config-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 12px;
}

.config-row label {
    font-size: 13px;
    color: #aaa;
    min-width: 120px;
}

.config-row input[type="range"] {
    flex: 1;
    accent-color: #e94560;
}

.config-row input[type="text"],
.config-row input[type="number"] {
    flex: 1;
    padding: 6px 10px;
    background: #1a1a2e;
    color: #e0e0e0;
    border: 1px solid #0f3460;
    border-radius: 4px;
    font-family: inherit;
    font-size: 13px;
}

.config-row select {
    flex: 1;
}

textarea {
    width: 100%;
    padding: 8px 10px;
    background: #1a1a2e;
    color: #e0e0e0;
    border: 1px solid #0f3460;
    border-radius: 4px;
    font-family: inherit;
    font-size: 13px;
    resize: vertical;
}

.config-btn-small {
    padding: 4px 12px;
    font-size: 11px;
    margin-bottom: 8px;
}

.agent-def-row {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
    align-items: center;
}

.agent-def-row input {
    flex: 1;
    padding: 4px 8px;
    background: #1a1a2e;
    color: #e0e0e0;
    border: 1px solid #0f3460;
    border-radius: 4px;
    font-family: inherit;
    font-size: 12px;
}

.agent-def-row .remove-def {
    padding: 2px 6px;
    font-size: 10px;
    color: #e74c3c;
    border-color: #e74c3c;
    background: transparent;
}

.config-start-btn {
    display: block;
    width: 100%;
    padding: 14px;
    font-size: 18px;
    font-weight: bold;
    background: #e94560;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 3px;
    transition: all 0.3s;
}

.config-start-btn:hover {
    background: #c73651;
    box-shadow: 0 0 20px rgba(233, 69, 96, 0.5);
}

/* ── App Layout ── */
#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Top Bar */
#topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: #16213e;
    border-bottom: 2px solid #0f3460;
    flex-shrink: 0;
    z-index: 10;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.topbar-left h1 {
    font-size: 20px;
    color: #e94560;
    text-shadow: 0 0 10px rgba(233, 69, 96, 0.5);
}

#time-display {
    font-size: 16px;
    color: #f0c040;
}

#weather-display {
    font-size: 13px;
    color: #88bbee;
    padding: 2px 8px;
    border: 1px solid #0f3460;
    border-radius: 4px;
}

#event-display {
    font-size: 13px;
    color: #ffd700;
    font-weight: bold;
}

.world-ticker {
    font-size: 12px;
    color: #aaa;
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

button {
    padding: 6px 16px;
    border: 1px solid #0f3460;
    background: #16213e;
    color: #e0e0e0;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

button:hover:not(:disabled) {
    background: #0f3460;
    border-color: #e94560;
}

button:disabled {
    opacity: 0.4;
    cursor: default;
}

select {
    padding: 4px 8px;
    background: #16213e;
    color: #e0e0e0;
    border: 1px solid #0f3460;
    font-family: inherit;
    border-radius: 4px;
}

label {
    font-size: 13px;
}

/* Main Content */
#main-content {
    display: flex;
    flex: 1;
    min-height: 0;
    position: relative;
}

/* 3D Container - takes full remaining height (no feed) */
#three-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#three-container canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.need-bar-container {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-bottom: 1px;
}

.need-label {
    font-size: 8px;
    width: 22px;
    color: #888;
    text-transform: uppercase;
}

.need-bar {
    flex: 1;
    height: 4px;
    background: #0a0a1a;
    border-radius: 3px;
    overflow: hidden;
}

.need-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.need-bar-fill.energy { background: #f1c40f; }
.need-bar-fill.hunger { background: #e67e22; }
.need-bar-fill.social { background: #2ecc71; }
.need-bar-fill.fulfillment { background: #9b59b6; }
.need-bar-fill.health { background: #e74c3c; }
.need-bar-fill.safety { background: #3498db; }
.need-bar-fill.comfort { background: #1abc9c; }
.need-bar-fill.fun { background: #ff69b4; }
.need-bar-fill.morality { background: #9b59b6; }

.agent-card-stats {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    color: #888;
    margin-top: 3px;
}

/* Overlay panels */
.overlay-panel {
    position: fixed;
    background: rgba(22, 33, 62, 0.97);
    border: 2px solid #0f3460;
    border-radius: 8px;
    padding: 16px;
    z-index: 20;
    min-width: 300px;
    max-height: 70vh;
    overflow-y: auto;
}

.overlay-panel h3 {
    color: #e94560;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-btn {
    padding: 2px 8px;
    font-size: 12px;
    background: transparent;
    border: 1px solid #e94560;
    color: #e94560;
}

.hidden {
    display: none !important;
}

#economy-panel {
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
}

/* Agent Detail Panel - slide-in right panel */
.detail-panel {
    position: fixed;
    top: 50px;
    right: 0;
    bottom: 0;
    width: 400px;
    background: rgba(22, 33, 62, 0.98);
    border-left: 2px solid #0f3460;
    z-index: 20;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #0f3460;
    flex-shrink: 0;
}

.detail-header h3 {
    color: #e94560;
    font-size: 16px;
}

/* Detail Tabs */
.detail-tabs {
    display: flex;
    border-bottom: 1px solid #0f3460;
    flex-shrink: 0;
}

.detail-tab {
    flex: 1;
    padding: 8px 12px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: #888;
    cursor: pointer;
    border-radius: 0;
}

.detail-tab.active {
    color: #e94560;
    border-bottom-color: #e94560;
}

.detail-tab:hover {
    color: #e0e0e0;
    background: rgba(15, 52, 96, 0.3);
}

.detail-tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
}

.detail-tab-content.active {
    display: block;
}

.economy-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid rgba(15, 52, 96, 0.3);
    font-size: 12px;
}

.economy-label { color: #888; }
.economy-value { color: #f0c040; font-weight: bold; }

/* Minimap */
#minimap-container {
    position: fixed;
    bottom: 10px;
    left: 10px;
    z-index: 15;
    border: 2px solid #0f3460;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
}

#minimap-canvas {
    display: block;
    background: #1a1a2e;
}

/* Toast notifications */
#toast-container {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: rgba(22, 33, 62, 0.95);
    border: 2px solid #ffd700;
    border-radius: 8px;
    padding: 12px 20px;
    color: #ffd700;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    animation: toastIn 0.4s ease, toastOut 0.4s ease 3.6s forwards;
    pointer-events: auto;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
    from { opacity: 1; }
    to { opacity: 0; transform: translateY(-20px); }
}

/* Detail panel content */
.detail-section {
    margin-bottom: 12px;
}

.detail-section h4 {
    color: #888;
    font-size: 11px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.detail-memory {
    font-size: 11px;
    padding: 2px 0;
    color: #aaa;
}

.detail-relationship {
    font-size: 11px;
    padding: 2px 0;
    display: flex;
    justify-content: space-between;
}

/* Conversation log entries */
.conv-entry {
    background: rgba(15, 52, 96, 0.2);
    border-radius: 4px;
    padding: 8px;
    margin-bottom: 8px;
    border-left: 2px solid #3498db;
}

.conv-entry-header {
    font-size: 10px;
    color: #888;
    margin-bottom: 4px;
}

.conv-entry-line {
    font-size: 11px;
    padding: 2px 0;
}

.thought-entry {
    background: rgba(155, 89, 182, 0.1);
    border-radius: 4px;
    padding: 6px 8px;
    margin-bottom: 4px;
    border-left: 2px solid #9b59b6;
    font-size: 11px;
    color: #bbb;
    font-style: italic;
}

.thought-entry-tick {
    font-size: 9px;
    color: #666;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: #1a1a2e;
}
::-webkit-scrollbar-thumb {
    background: #0f3460;
    border-radius: 3px;
}

/* SOK Visual World V0.6 – readable overlay on existing Three.js scene */
.sok-version { font-size: 9px; font-weight: 700; color: #75d5b0; vertical-align: middle; letter-spacing: 1px; }
.sok-visual-hud {
    position: absolute; top: 16px; left: 16px; width: min(360px, calc(100% - 32px));
    z-index: 4; background: rgba(12, 24, 34, .92); color: #e9f5f2;
    border: 1px solid rgba(137, 227, 195, .35); border-radius: 12px;
    box-shadow: 0 15px 45px rgba(0, 0, 0, .30); overflow: hidden;
    font-family: system-ui, -apple-system, sans-serif; backdrop-filter: blur(12px);
}
.sok-hud-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 13px 15px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sok-hud-brand { color: #95ead0; font-weight: 800; font-size: 11px; letter-spacing: 1.5px; }
.sok-status { font-size: 11px; color: #82e6af; }
.sok-status.sok-offline { color: #ffc68e; }
.sok-hud-content { padding: 13px 15px 10px; }
.sok-hud-metrics { display: grid; grid-template-columns: 1fr 1fr 1.25fr; gap: 8px; }
.sok-hud-metrics > div { padding: 11px 9px; border-radius: 8px; background: rgba(255,255,255,.055); min-width: 0; }
.sok-hud-metrics small { display: block; font-size: 9px; color: #92a9ae; letter-spacing: 1px; margin-bottom: 7px; }
.sok-hud-metrics strong { display: block; font-size: 16px; color: #f5faf9; white-space: nowrap; }
#sok-world-mode { font-size: 11px; color: #ffd39c; }
#sok-world-mode.sok-running { color: #75e2b7; }
.sok-hud-save { display: flex; justify-content: space-between; gap: 8px; margin-top: 11px; color: #a6b8bb; font-size: 11px; }
.sok-hud-save strong { color: #8ce3c3; }
.sok-hud-heading { margin: 17px 0 9px; color: #9db7b8; font-size: 10px; letter-spacing: 1.3px; font-weight: 700; }
.sok-camera-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.sok-camera-actions button { border: 1px solid rgba(132,221,189,.4); border-radius: 7px; background: rgba(53,114,99,.25); color: #e3fff5; font: 600 11px system-ui,sans-serif; padding: 7px 10px; }
.sok-camera-actions button:hover { background: rgba(68,169,141,.4); }
.sok-focus-list { display: flex; flex-wrap: wrap; gap: 6px; }
.sok-hud-selected { margin: 9px 0 0; color: #9fb7b7; font-size: 11px; }
.sok-activity-list { list-style: none; max-height: 160px; overflow-y: auto; margin: 0; padding: 0; }
.sok-activity-list li { display: flex; flex-direction: column; gap: 3px; padding: 8px 0; font-size: 11px; border-bottom: 1px solid rgba(255,255,255,.075); }
.sok-activity-list li strong { color: #99e4cd; font-size: 10px; }
.sok-activity-list li span { color: #dae5e4; line-height: 1.4; overflow-wrap: anywhere; }
.sok-hud-toggle { width: 100%; background: rgba(51,104,88,.2); border: 0; border-radius: 0; color: #b5eadb; font: 600 10px system-ui,sans-serif; padding: 9px; }
.sok-hud-collapsed .sok-hud-content { display: none; }
.sok-hud-hint { position: absolute; z-index: 3; bottom: 15px; left: 16px; padding: 8px 12px; color: #e5f4ed; background: rgba(12,24,34,.78); border-radius: 7px; font: 11px system-ui,sans-serif; pointer-events: none; }
@media (max-width: 780px) { .sok-visual-hud { width: min(310px, calc(100% - 24px)); top: 8px; left: 8px; } .sok-hud-hint { display: none; } .sok-activity-list { max-height: 100px; } }

/* V0.6: de oorspronkelijke rechter sidebar is volledig verwijderd. */
#three-container { min-width: 0; }

/* V0.7: scenery detail switch stays in the single SOK World Control */
.sok-nature-control { display:flex; align-items:center; gap:9px; margin: 9px 0 12px;
    padding: 9px 10px; background: rgba(25,72,52,.45); border: 1px solid rgba(92,180,125,.28);
    border-radius: 7px; color:#c7efd4; font: 12px system-ui,sans-serif; cursor:pointer; }
.sok-nature-control input { accent-color:#62c78c; width:15px; height:15px; cursor:pointer; }

/* SOK V0.9 visual-only world editor; separate design overlay, not another world control */
.sok-editor-trigger { margin-top: 13px; }
.sok-editor-trigger button { width: 100%; border: 1px solid #62b9a4; color: #c4fff2; background: #194f4b; border-radius: 7px; padding: 9px; cursor: pointer; }
.sok-editor-panel { position: absolute; right: 16px; top: 16px; z-index: 11; width: min(290px, calc(100% - 32px)); background: rgba(12, 27, 35, .95); color: #e3eee9; border: 1px solid #448e7d; border-radius: 12px; box-shadow: 0 12px 38px #0007; padding: 15px; font: 12px system-ui,sans-serif; }
.sok-editor-panel[hidden] { display: none !important; }
.sok-editor-panel h3 { margin: 0 0 8px; font-size: 14px; letter-spacing: 1px; color: #99e4ca; }
.sok-editor-panel h3 span { font-size: 10px; color: #93aeb2; }
.sok-editor-warning { color: #ffd7a0; background: #50392255; padding: 9px; border-radius: 6px; line-height: 1.4; }
.sok-editor-panel label { display: block; margin: 12px 0 6px; color: #a5ccc4; }
.sok-editor-panel select { width: 100%; padding: 9px; border-radius: 5px; color: white; background: #19343e; border: 1px solid #447267; }
.sok-editor-buttons { display: grid; gap: 7px; grid-template-columns: 1fr 1fr; margin-top: 12px; }
.sok-editor-buttons button { padding: 8px; background: #224943; color: #d4fff0; border: 1px solid #456e66; border-radius: 6px; cursor: pointer; }
.sok-editor-buttons button:last-child { grid-column: span 2; background: #4b3537; border-color: #805357; }
.sok-editor-status { color: #9ad8cb; font-size: 11px; margin: 12px 0 5px; }
.sok-editor-panel small { display: block; color: #a8b6b5; line-height: 1.5; }

/* SOK V1.0: terreinbewerking */
.sok-sculpt-controls { display: grid; gap: 5px; padding: 9px; margin: 7px 0; background: rgba(20,40,42,.75); border: 1px solid #335e50; border-radius: 7px; }
.sok-sculpt-controls label { font-size: 11px; color: #cbe3d4; }
.sok-sculpt-controls input[type="range"] { width: 100%; accent-color: #6ed29a; }
