:root {
    --bg-dungeon: #1e1d2a;
    --grid-line: #3a3848;
    --room-border: #5c5878;
    --parchment-gold: #e6d9a2;
    --stone-gray: #c8c0b4;
    --commentary: #8a7e6b;
    --corridor: #4a4668;
    --recursive: #6b6590;
}

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

body {
    background-color: var(--bg-dungeon);
    background-image:
        repeating-linear-gradient(var(--grid-line) 0 1px, transparent 1px calc(100vw / 16)),
        repeating-linear-gradient(90deg, var(--grid-line) 0 1px, transparent 1px calc(100vw / 16));
    background-size: calc(100vw / 16) calc(100vw / 16);
    color: var(--stone-gray);
    font-family: 'Inconsolata', monospace;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.1vw, 1.05rem);
    line-height: 1.75;
    overflow-x: hidden;
}

.section {
    position: relative;
    min-height: 100vh;
    padding: 80px 40px;
}

/* Room Styling */
.room {
    outline: 2px solid var(--room-border);
    padding: 40px;
    position: relative;
}

.room-label {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.7rem;
    color: var(--corridor);
    letter-spacing: 0.1em;
    display: block;
    margin-bottom: 12px;
}

.room-title {
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    color: var(--parchment-gold);
    margin-bottom: 24px;
    line-height: 1.4;
}

.domain-name {
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(1.5rem, 4vw, 3rem);
    color: var(--parchment-gold);
    margin-bottom: 24px;
    line-height: 1.3;
}

.imperative {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.8rem;
    color: var(--parchment-gold);
    margin-bottom: 20px;
}

.paradox-text {
    color: var(--stone-gray);
    margin-bottom: 16px;
}

/* Antechamber */
#antechamber {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 10vh;
}

.room-antechamber {
    max-width: calc(100vw / 16 * 6);
    margin-left: calc(100vw / 16);
}

.descend-arrow {
    font-family: 'Press Start 2P', monospace;
    font-size: 1.5rem;
    color: var(--parchment-gold);
    text-align: center;
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    animation: descend 2s infinite;
}

@keyframes descend {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* Room Layouts */
.room-layout {
    display: flex;
    gap: 0;
    align-items: flex-start;
}

.left-room {
    margin-right: 20%;
}

.left-room .room {
    width: 60%;
}

.right-room {
    justify-content: flex-end;
    margin-left: 20%;
}

.right-room .room {
    width: 70%;
}

/* Corridors */
.horizontal-corridor {
    width: calc(100vw / 16);
    min-height: 2px;
    background: var(--corridor);
    align-self: center;
}

/* Note Block */
.note-block {
    outline: 1px solid var(--corridor);
    padding: 20px;
    max-width: calc(100vw / 16 * 3);
}

.note-label {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.5rem;
    color: var(--corridor);
    display: block;
    margin-bottom: 8px;
}

.note-text {
    font-family: 'Crimson Text', Georgia, serif;
    font-style: italic;
    font-size: 0.9rem;
    color: var(--commentary);
    line-height: 1.6;
}

/* Liar's Loop */
.liar-text-container {
    position: relative;
}

.liar-loop {
    width: 100%;
    height: 60px;
    opacity: 0.6;
}

/* Nested Sets (Russell) */
.nested-set {
    margin-top: 20px;
}

.set-border {
    border: 2px solid var(--corridor);
    padding: 20px;
}

.set-border.level-1 {
    border-color: var(--corridor);
}

.set-border.level-2 {
    border-color: var(--room-border);
}

.set-border.level-3 {
    border-color: var(--recursive);
}

/* Zeno's Corridor */
.room-zeno {
    max-width: 30%;
    margin: 0 auto;
}

.zeno-steps {
    margin-top: 20px;
}

.zeno-step {
    outline: 1px solid var(--grid-line);
    padding: 16px;
}

/* Doorframes (Recursive) */
.room-exit {
    max-width: 70%;
    margin: 0 auto;
}

.doorframe {
    border: 2px solid var(--room-border);
    padding: 15px;
    margin: 10px;
}

.exit-text {
    font-family: 'Inconsolata', monospace;
    color: var(--stone-gray);
    text-align: center;
    margin-bottom: 8px;
}

.exit-question {
    font-family: 'Crimson Text', Georgia, serif;
    font-style: italic;
    color: var(--commentary);
    text-align: center;
    font-size: 0.9rem;
}

/* Room fade-in */
[data-room] {
    opacity: 0;
    transition: opacity 0.3s ease;
}

[data-room].revealed {
    opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .room-layout {
        flex-direction: column;
    }

    .left-room, .right-room {
        margin: 0;
    }

    .left-room .room, .right-room .room {
        width: 100%;
    }

    .room-zeno {
        max-width: 90%;
    }

    .room-exit {
        max-width: 95%;
    }

    .note-block {
        max-width: 100%;
    }

    .horizontal-corridor {
        width: 100%;
        min-height: 1px;
        height: 1px;
    }

    .room-antechamber {
        max-width: 90%;
    }
}
