:root {
    --bg: #1a1a2e;
    --bg-card: rgba(255,255,255,0.05);
    --fg: #eaeaea;
    --accent: #4ecdc4;
    --warning: #ffd93d;
    --danger: #ff6b6b;
    --success: #6bcb77;
}

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

body {
    font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
    background: var(--bg);
    color: var(--fg);
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

h1 {
    color: var(--accent);
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.subtitle {
    opacity: 0.7;
    font-size: 0.9rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.card {
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 15px;
}

.card h2 {
    color: var(--accent);
    font-size: 0.85rem;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.metric {
    font-size: 2.5rem;
    font-weight: bold;
    line-height: 1;
    margin-bottom: 10px;
}

.metric-sm {
    font-size: 1.5rem;
    font-weight: bold;
}

.label {
    font-size: 0.75rem;
    opacity: 0.7;
}

.row {
    display: flex;
    justify-content: space-between;
    margin: 8px 0;
    font-size: 0.85rem;
}

/* Gauge */
.gauge-container {
    margin: 10px 0;
}

.gauge {
    height: 24px;
    background: rgba(255,255,255,0.1);
    border-radius: 12px;
    overflow: hidden;
}

.gauge-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #45b7aa);
    transition: width 0.3s ease;
    border-radius: 12px;
}

/* Emotional Grid */
.emotional-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    text-align: center;
}

.emotional-value {
    font-size: 1.3rem;
    font-weight: bold;
    margin-bottom: 4px;
}

/* Memory Grid */
.memory-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    text-align: center;
}

.memory-grid > div {
    min-width: 0;
    overflow: hidden;
}

.memory-grid .metric-sm {
    font-size: 1.1rem;
    white-space: nowrap;
}

/* Actor Grid */
.actor-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.actor {
    padding: 10px;
    border-radius: 6px;
    background: rgba(107, 203, 119, 0.15);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.actor.dead {
    background: rgba(255, 107, 107, 0.15);
}

.actor-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success);
    flex-shrink: 0;
}

.actor.dead .actor-dot {
    background: var(--danger);
}

/* Thought Stream */
.thought-card {
    margin-top: 15px;
}

.thought-stream {
    max-height: 350px;
    overflow-y: auto;
}

.thought {
    padding: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    font-size: 0.85rem;
    display: flex;
    gap: 12px;
}

.thought:last-child {
    border-bottom: none;
}

.thought:hover {
    background: rgba(255,255,255,0.03);
}

.salience {
    color: var(--warning);
    font-weight: bold;
    min-width: 45px;
    font-size: 0.8rem;
}

.thought-content {
    flex: 1;
    word-break: break-word;
    opacity: 0.9;
}

/* Status */
.status {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
    background: var(--success);
    color: #000;
}

.status.error {
    background: var(--danger);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.3);
}

/* Thought Manifold */
.manifold-card {
    margin: 15px 0;
}

.manifold-subtitle {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-bottom: 10px;
}

.manifold-canvas {
    width: 100%;
    max-width: 600px;
    height: auto;
    border-radius: 8px;
    cursor: grab;
    display: block;
    margin: 0 auto;
}

.manifold-canvas:active {
    cursor: grabbing;
}

.manifold-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 10px;
    font-size: 0.75rem;
    opacity: 0.7;
}

.legend-crystal {
    color: #ffd700;
}

.legend-thought {
    color: #00ffff;
}

/* THE BOX */
.the-box-card h2 {
    color: var(--success);
}

.laws-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

.law {
    font-family: monospace;
    font-weight: bold;
}

.law.active {
    color: var(--success);
}

.law.warning {
    color: var(--warning);
}

.law.violation {
    color: var(--danger);
}

.laws-status {
    color: var(--success);
    font-weight: bold;
    font-size: 0.85rem;
    margin-left: auto;
}

.box-message {
    font-size: 0.8rem;
    opacity: 0.7;
    font-style: italic;
    margin-bottom: 8px;
}

.box-footer {
    font-size: 0.75rem;
    color: var(--accent);
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 8px;
    margin-top: 8px;
}

/* =============================================================================
   OBSERVATORY COMPONENTS
   ============================================================================= */

.observatory-section {
    margin: 25px 0;
}

.section-title {
    color: var(--accent);
    font-size: 1rem;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-bottom: 1px solid rgba(78, 205, 196, 0.3);
    padding-bottom: 8px;
}

.observatory-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 15px;
}

.metrics-column {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

@media (max-width: 900px) {
    .observatory-grid {
        grid-template-columns: 1fr;
    }
}

/* Philosophy Card */
.philosophy-card {
    background: linear-gradient(135deg, rgba(78, 205, 196, 0.1), rgba(69, 183, 170, 0.05));
    border: 1px solid rgba(78, 205, 196, 0.3);
    margin-bottom: 15px;
    text-align: center;
    padding: 20px;
}

.philosophy-quote {
    font-style: italic;
    font-size: 1.1rem;
    color: var(--accent);
    line-height: 1.5;
}

/* Stream Competition Card */
.stream-card {
    min-height: 300px;
}

.stream-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 0.85rem;
}

.competition-level {
    color: var(--warning);
    font-weight: bold;
}

.active-count {
    opacity: 0.7;
}

.streams {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stream-row {
    display: grid;
    grid-template-columns: 100px 1fr 50px;
    gap: 10px;
    align-items: center;
    font-size: 0.8rem;
}

.stream-name {
    color: var(--fg);
    opacity: 0.8;
    font-weight: 500;
}

.stream-bar-container {
    height: 16px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    overflow: hidden;
}

.stream-bar {
    height: 100%;
    background: linear-gradient(90deg, rgba(78, 205, 196, 0.6), rgba(78, 205, 196, 0.8));
    border-radius: 8px;
    transition: width 0.3s ease;
}

.stream-bar.dominant {
    background: linear-gradient(90deg, var(--warning), #e6c332);
    box-shadow: 0 0 10px rgba(255, 217, 61, 0.4);
}

.stream-value {
    text-align: right;
    font-weight: bold;
    font-size: 0.75rem;
}

/* Entropy Card */
.entropy-card h2 {
    color: #9b59b6;
}

.entropy-value {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 10px;
    color: #9b59b6;
}

.entropy-gauge {
    height: 20px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}

.entropy-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #9b59b6, #e74c3c);
    border-radius: 10px;
    transition: width 0.3s ease;
}

.entropy-description {
    font-size: 0.85rem;
    font-weight: bold;
    text-align: center;
    margin: 8px 0;
}

.entropy-scale {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    opacity: 0.6;
}

/* Fractality Card */
.fractality-card h2 {
    color: #e67e22;
}

.fractality-score {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 10px;
    color: #e67e22;
}

.fractality-gauge {
    height: 20px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}

.fractality-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2ecc71, #e67e22);
    border-radius: 10px;
    transition: width 0.3s ease;
}

.fractality-description {
    font-size: 0.85rem;
    font-weight: bold;
    text-align: center;
    margin: 8px 0;
}

.fractality-stats {
    font-size: 0.75rem;
    opacity: 0.7;
    text-align: center;
}

/* Memory Windows Card */
.memory-windows-card h2 {
    color: #1abc9c;
}

.windows-header {
    text-align: center;
    font-size: 0.85rem;
    margin-bottom: 12px;
    opacity: 0.8;
}

.memory-slots {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 6px;
}

.slot {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    opacity: 0.4;
    transition: all 0.3s ease;
}

.slot.active {
    background: rgba(26, 188, 156, 0.4);
    border: 1px solid rgba(26, 188, 156, 0.6);
    opacity: 1;
    box-shadow: 0 0 8px rgba(26, 188, 156, 0.3);
}

/* Clustering Card (VCONN-7) */
.clustering-card h2 {
    color: #3498db;
}

.clustering-score {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 10px;
    color: #3498db;
    text-align: center;
}

.clustering-gauge {
    height: 20px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}

.clustering-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--warning), #e6c332);
    border-radius: 10px;
    transition: width 0.3s ease;
}

.clustering-fill.structured {
    background: linear-gradient(90deg, var(--success), #45b7aa);
}

.clustering-status {
    font-size: 0.85rem;
    font-weight: bold;
    text-align: center;
    margin: 8px 0;
    color: var(--warning);
}

.clustering-fill.structured + .clustering-status,
.clustering-card:has(.clustering-fill.structured) .clustering-status {
    color: var(--success);
}

.clustering-label {
    font-size: 0.7rem;
    opacity: 0.6;
    text-align: center;
}
