/* === RESET & BASE === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    color: #3d3552;
    background: #f4f0f8;
}

/* === DASHBOARD GRID === */
.dashboard {
    display: grid;
    grid-template-columns: 240px 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    grid-template-areas:
        "premise inference inference"
        "contradiction evidence conclusion";
    height: 100vh;
    width: 100vw;
    gap: 2px;
    background: linear-gradient(135deg, #d4c9e8, #c8a4b8, #b8a0d8);
    animation: seam-breathe 30s ease infinite;
}

@keyframes seam-breathe {
    0%, 100% { background: linear-gradient(135deg, #d4c9e8, #c8a4b8, #b8a0d8); }
    50% { background: linear-gradient(135deg, #b8a0d8, #d4c9e8, #c8a4b8); }
}

/* === PANEL BASE === */
.panel {
    position: relative;
    border: 1px solid #d4c9e8;
    box-shadow: inset 0 0 40px rgba(180, 160, 210, 0.06);
    overflow: hidden;
    padding: 1.5rem;
    transition: box-shadow 0.6s ease;
}

.panel:hover {
    box-shadow: inset 0 0 60px rgba(180, 160, 210, 0.12);
}

.panel__label {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(1.4rem, 2.5vw, 2.2rem);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #4a3f6b;
    margin-bottom: 1rem;
}

.panel__index {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    color: #9b8fb8;
}

.panel__content {
    font-size: clamp(0.95rem, 1.3vw, 1.15rem);
    line-height: 1.72;
}

.panel__content p {
    margin-bottom: 1.2em;
    max-width: 52ch;
}

/* === MARBLE TEXTURES === */
.panel--premise {
    grid-area: premise;
    background:
        radial-gradient(ellipse at 20% 30%, rgba(212, 201, 232, 0.07) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 70%, rgba(200, 164, 184, 0.05) 0%, transparent 50%),
        linear-gradient(135deg, rgba(184, 160, 216, 0.04) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 90%, rgba(212, 201, 232, 0.06) 0%, transparent 70%),
        #ece7f3;
}

.panel--inference {
    grid-area: inference;
    background:
        radial-gradient(ellipse at 70% 20%, rgba(200, 164, 184, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 30% 80%, rgba(184, 160, 216, 0.05) 0%, transparent 60%),
        linear-gradient(160deg, rgba(212, 201, 232, 0.04) 0%, transparent 30%),
        radial-gradient(ellipse at 90% 60%, rgba(200, 164, 184, 0.04) 0%, transparent 40%),
        radial-gradient(ellipse at 10% 40%, rgba(212, 201, 232, 0.03) 0%, transparent 50%),
        #ece7f3;
}

.panel--contradiction {
    grid-area: contradiction;
    background:
        radial-gradient(ellipse at 40% 50%, rgba(184, 160, 216, 0.07) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(200, 164, 184, 0.05) 0%, transparent 50%),
        linear-gradient(200deg, rgba(212, 201, 232, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 20% 80%, rgba(200, 164, 184, 0.04) 0%, transparent 40%),
        #ece7f3;
}

.panel--evidence {
    grid-area: evidence;
    background:
        radial-gradient(ellipse at 60% 30%, rgba(212, 201, 232, 0.06) 0%, transparent 55%),
        radial-gradient(ellipse at 20% 70%, rgba(184, 160, 216, 0.05) 0%, transparent 45%),
        linear-gradient(170deg, rgba(200, 164, 184, 0.04) 0%, transparent 35%),
        radial-gradient(ellipse at 85% 85%, rgba(212, 201, 232, 0.04) 0%, transparent 50%),
        #ece7f3;
}

.panel--conclusion {
    grid-area: conclusion;
    background:
        radial-gradient(ellipse at 30% 40%, rgba(200, 164, 184, 0.06) 0%, transparent 55%),
        radial-gradient(ellipse at 70% 80%, rgba(184, 160, 216, 0.07) 0%, transparent 50%),
        linear-gradient(145deg, rgba(212, 201, 232, 0.03) 0%, transparent 40%),
        radial-gradient(ellipse at 90% 10%, rgba(200, 164, 184, 0.04) 0%, transparent 45%),
        radial-gradient(ellipse at 50% 50%, rgba(212, 201, 232, 0.05) 0%, transparent 60%),
        #ece7f3;
}

/* === PREMISE PANEL === */
.panel--premise {
    display: flex;
    flex-direction: column;
}

.panel--premise .panel__content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.premise-text {
    font-size: clamp(1.1rem, 1.8vw, 1.4rem);
    line-height: 1.6;
    text-align: center;
    padding: 0 0.5rem;
    transition: filter 0.8s ease, opacity 0.8s ease;
}

.premise-text.blur {
    filter: blur(4px);
    opacity: 0.4;
}

.wordmark {
    display: block;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    color: #9b8fb8;
    margin-top: auto;
}

.stream-status {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    color: #9b8fb8;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.status-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #8fa88d;
    animation: pulse-dot 2s ease infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* === INFERENCE PANEL (AUTO-SCROLL) === */
.panel--inference .panel__content--autoscroll {
    position: absolute;
    top: 4.5rem;
    left: 1.5rem;
    right: 1.5rem;
    bottom: 1.5rem;
    overflow: hidden;
}

.scroll-inner {
    animation: autoscroll 200s linear infinite;
}

.panel--inference:hover .scroll-inner {
    animation-play-state: paused;
}

@keyframes autoscroll {
    from { transform: translateY(0); }
    to { transform: translateY(-50%); }
}

/* === GLITCH WORD === */
.glitch-word {
    display: inline-block;
    transition: transform 0.2s ease, color 0.2s ease, filter 0.2s ease;
}

.glitch-word.glitching {
    transform: translateX(2px);
    color: #b8a0d8;
    filter: blur(1px);
}

/* === PANEL BORDER GLITCH === */
.panel.border-glitch::after {
    content: '';
    position: absolute;
    inset: -1px;
    border: 1px solid #c8a4b8;
    pointer-events: none;
    transform: translate(1px, -1px);
    animation: border-glitch-fade 0.15s ease forwards;
}

@keyframes border-glitch-fade {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* === CONTRADICTION GAUGE === */
.gauge-container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.panel--contradiction {
    display: flex;
    flex-direction: column;
}

.gauge {
    display: block;
}

.gauge-needle {
    transform-origin: 70px 70px;
    transition: transform 0.1s;
}

/* === EVIDENCE CAROUSEL === */
.panel__content--carousel {
    position: absolute;
    top: 4.5rem;
    left: 1.5rem;
    right: 1.5rem;
    bottom: 1.5rem;
    overflow: hidden;
}

.evidence-track {
    display: flex;
    transition: transform 0.8s ease;
    height: 100%;
}

.evidence-card {
    min-width: 100%;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.evidence-card p {
    font-size: clamp(0.9rem, 1.2vw, 1.05rem);
    line-height: 1.7;
    font-style: italic;
    color: #3d3552;
}

.evidence-meta {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    color: #9b8fb8;
    margin-bottom: 0.8rem;
    display: block;
}

/* === CONCLUSION TYPEWRITER === */
.panel__content--typewriter {
    position: absolute;
    top: 4.5rem;
    left: 1.5rem;
    right: 1.5rem;
    bottom: 1.5rem;
    display: flex;
    align-items: center;
}

.conclusion-text {
    font-size: clamp(0.95rem, 1.3vw, 1.15rem);
    line-height: 1.72;
    color: #8fa88d;
}

.conclusion-text .char-new {
    filter: blur(3px);
    opacity: 0.3;
    animation: char-focus 0.6s ease forwards;
}

@keyframes char-focus {
    to { filter: blur(0); opacity: 1; }
}

.cursor {
    display: inline-block;
    width: 2px;
    height: 1.1em;
    background: #8fa88d;
    vertical-align: text-bottom;
    animation: blink-cursor 1s step-end infinite;
}

@keyframes blink-cursor {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* === LICHEN SVGs === */
.lichen {
    position: absolute;
    pointer-events: none;
}

.lichen--fiddlehead {
    bottom: 3rem;
    right: 0.5rem;
}

.lichen--foliose {
    bottom: 0;
    left: 1rem;
}

.lichen--crustose {
    bottom: 0.8rem;
    right: 0.8rem;
}

.lichen--branch {
    bottom: 0;
    right: 0;
}

/* === TUNE BUTTON === */
.tune-btn {
    position: fixed;
    bottom: 1.2rem;
    right: 1.2rem;
    width: 44px;
    height: 44px;
    border: none;
    background: rgba(236, 231, 243, 0.85);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: background 0.3s ease;
}

.tune-btn:hover {
    background: rgba(212, 201, 232, 0.9);
}

/* === TUNE OVERLAY === */
.tune-overlay {
    position: fixed;
    inset: 0;
    background: rgba(244, 240, 248, 0.92);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.tune-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.tune-content {
    text-align: center;
}

.tune-content h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.8rem;
    color: #4a3f6b;
    letter-spacing: 0.06em;
    margin-bottom: 0.5rem;
}

.tune-description {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: #9b8fb8;
    margin-bottom: 2rem;
}

.tune-options {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 2rem;
}

.tune-option {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem;
    color: #3d3552;
    background: rgba(236, 231, 243, 0.7);
    border: 1px solid #d4c9e8;
    padding: 0.7rem 1.5rem;
    cursor: pointer;
    transition: background 0.3s, border-color 0.3s;
}

.tune-option:hover, .tune-option.active {
    background: rgba(212, 201, 232, 0.5);
    border-color: #b8a0d8;
}

.tune-close {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: #9b8fb8;
    background: none;
    border: 1px solid #d4c9e8;
    padding: 0.5rem 1.2rem;
    cursor: pointer;
    transition: color 0.3s;
}

.tune-close:hover {
    color: #4a3f6b;
}

/* === MARBLE VEIN SHIMMER === */
.panel.shimmer::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at var(--shimmer-x, 50%) var(--shimmer-y, 50%), rgba(212, 201, 232, 0.1) 0%, transparent 50%);
    pointer-events: none;
    animation: shimmer-fade 1.5s ease forwards;
}

@keyframes shimmer-fade {
    0% { opacity: 0; }
    30% { opacity: 1; }
    100% { opacity: 0; }
}
