.draw-word {
    flex: 1;
    background: none;
    border: none;
    border-bottom: 1px solid rgba(0,255,65,0.3);
    color: #00ff41;
    font-family: 'VT323', monospace;
    font-size: 22px;
    letter-spacing: 3px;
    padding: 4px 8px;
    outline: none;
    text-transform: uppercase;
    caret-color: #00ff41;
    pointer-events: all;
}
.draw-word::placeholder {
    color: rgba(0,255,65,0.2);
}
.draw-word:focus {
    border-bottom-color: rgba(0,255,65,0.7);
}

.draw-btn {
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.8);
    color: #fff;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 2px;
    padding: 12px 28px;
    cursor: pointer;
    transition: background 0.2s;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.draw-btn:hover {
    background: rgba(255,255,255,0.15);
}
.draw-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.expr-col {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: all;
}

.expr-col-left  { left: 80px; align-items: flex-start; }
.expr-col-right { right: 80px; align-items: flex-end; }

.expr-btn {
    background: none;
    border: none;
    color: #fff;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: clamp(1.8rem, 3vw, 2.8rem);
    font-weight: 700;
    letter-spacing: 0.01em;
    text-decoration: underline;
    text-underline-offset: 4px;
    text-transform: lowercase;
    padding: 0;
    cursor: pointer;
    opacity: 0.85;
    transition: opacity 0.2s;
}

.expr-btn:hover { opacity: 1; }
.expr-btn.active { opacity: 0.4; }

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    background-color: #000;
    font-family: 'Roboto Mono', monospace;
    color: rgba(255, 255, 255, 0.6);
    user-select: none;
    /* Scroll Snapping */
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
}

body {
    overflow-x: hidden;
}

@media (max-width: 768px) {
    body, html {
        overflow-y: hidden; /* Disable scrolling on mobile */
    }
}

/* Chapters Setup */
.chapter {
    position: relative;
    width: 100%;
    height: 100vh; /* Fallback for older browsers */
    height: 100dvh; /* Modern mobile-friendly viewport height */
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    scroll-snap-align: start; /* Snap to top of each chapter */
    scroll-snap-stop: always;
}

#chapter-1 {
    /* The canvas lives here */
}

#console-overlay {
    position: fixed;
    top: 40px;
    left: clamp(16px, 6vw, 80px);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 6px;
    pointer-events: none;
    white-space: nowrap;
    max-width: calc(100vw - clamp(32px, 12vw, 160px));
}

#console-line1 {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: clamp(1.8rem, 3vw, 2.8rem);
    font-weight: 700;
    color: rgba(255, 255, 255, 1);
    letter-spacing: 0.01em;
    margin: 0;
    line-height: 1.1;
}

#console-line2 {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: clamp(1.8rem, 3vw, 2.8rem);
    font-weight: 300;
    color: rgba(255, 255, 255, 1);
    letter-spacing: 0.01em;
    margin: 0;
    line-height: 1.3;
    min-height: 1.2em;
    white-space: normal;
}


.console-cursor {
    display: none;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.console-link {
    color: rgba(255, 255, 255, 1);
    text-decoration: underline;
    text-underline-offset: 3px;
    pointer-events: all;
}

.console-link:hover {
    opacity: 0.7;
}

.chapter-content {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
    max-width: 90%;
}

.chapter-content h2 {
    font-size: clamp(1.5rem, 5vw, 3rem);
    letter-spacing: clamp(2px, 1vw, 5px);
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 20px;
}

.chapter-content p {
    max-width: 600px;
    line-height: 1.6;
    margin: 0 auto;
    font-size: clamp(0.9rem, 2vw, 1.1rem);
}

#eyeImage {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    pointer-events: none;
}

canvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    pointer-events: none;
}

/* UI Elements (Floating) */
.ui-element {
    position: fixed;
    z-index: 100;
    font-size: 10px;
    letter-spacing: 1px;
    pointer-events: none; /* Let clicks pass through */
}

.top-left { top: 20px; left: 20px; }
.top-right { top: 20px; right: 20px; text-align: right; }
.bottom-left { bottom: 20px; left: 20px; }
.bottom-right { bottom: 20px; right: 20px; text-align: right; }

.vertical-text {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    letter-spacing: 4px;
}

.vertical-text-left {
    writing-mode: vertical-rl;
    transform: translateY(-50%) rotate(180deg);
    position: fixed;
    left: 20px;
    top: 50%;
    letter-spacing: 4px;
}

.data-row {
    margin-bottom: 4px;
    display: flex;
    gap: 15px;
}

.data-label { color: rgba(255, 255, 255, 0.3); }
.data-value { color: rgba(255, 255, 255, 0.8); }


/* Responsive hiding for clutter on small screens */
@media (max-width: 768px) {
    .vertical-text, .vertical-text-left {
        display: none;
    }
    .ui-element {
        font-size: 8px;
    }
    .top-left { top: 10px; left: 10px; }
    .top-right { top: 10px; right: 10px; }
    .bottom-left { bottom: 10px; left: 10px; }
    .bottom-right { bottom: 10px; right: 10px; }
    
    .data-row { gap: 8px; margin-bottom: 2px; }

    .nav-arrow svg {
        width: 35px;
        height: 35px;
    }
    .nav-up { top: 10px; }
    .nav-down { bottom: 10px; }

    .projects-wrapper {
        top: 150px;
        left: 16px;
        right: 16px;
        bottom: 40px;
        border-radius: 8px;
    }

    .projects-wrapper::-webkit-scrollbar {
        height: 24px;
    }

    .projects-masonry {
        --panel-h: calc(100dvh - 190px);
        --content-h: calc(var(--panel-h) - 40px);
        --row-h: calc((var(--content-h) - 20px) / 2);
    }

    .project-overlay {
        opacity: 1;
        background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 60%);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .project-headline { font-size: 0.9rem; }
    .project-subline  { font-size: 0.7rem; }
    .project-text     { font-size: 0.75rem; }

    #draw-frame {
        top: 160px !important;
        height: calc(100% - 220px) !important;
    }
    #draw-inputs {
        bottom: 160px !important;
    }
    #draw-buttons {
        bottom: 90px !important;
    }
}

/* Large Navigation Arrows */
.nav-arrow {
    position: fixed;
    left: 50%;
    z-index: 1000;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.3s;
}

.nav-arrow:hover {
    opacity: 1;
}

.nav-arrow svg {
    width: 50px;
    height: 50px;
    filter: drop-shadow(0 0 5px rgba(255,255,255,0.5));
}

.nav-up {
    top: 30px;
    display: none; /* Hidden on first load */
    animation: bounce-up 2s infinite;
}

.nav-down {
    bottom: 30px;
    animation: bounce-down 2s infinite;
}

@keyframes bounce-up {
    0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); }
    40% { transform: translateX(-50%) translateY(-10px); }
    60% { transform: translateX(-50%) translateY(-5px); }
}

@keyframes bounce-down {
    0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); }
    40% { transform: translateX(-50%) translateY(10px); }
    60% { transform: translateX(-50%) translateY(5px); }
}

/* Projects Masonry */
#chapter-4 {
    overflow: hidden;
    scroll-snap-type: none;
}

.projects-wrapper {
    position: absolute;
    top: 240px;
    left: 80px;
    right: 80px;
    bottom: 80px;
    box-sizing: border-box;
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
}

.projects-wrapper::-webkit-scrollbar {
    height: 40px;
}
.projects-wrapper::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
    border-radius: 0 0 12px 12px;
}
.projects-wrapper::-webkit-scrollbar-thumb {
    background: #fff;
    border-radius: 0;
}

.projects-masonry {
    --panel-h: calc(100dvh - 320px);
    --content-h: calc(var(--panel-h) - 56px);
    --row-h: calc((var(--content-h) - 32px) / 2);
    display: grid;
    grid-template-rows: 1fr 1fr;
    grid-auto-flow: column;
    grid-auto-columns: auto;
    gap: 32px;
    height: var(--content-h);
}

.project-card {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    border-radius: 12px;
}

.project-card.landscape {
    grid-row: span 1;
    width: calc(var(--row-h) * 1.7778);
    height: 100%;
    border-radius: 8px;
}

.project-card.portrait {
    grid-row: span 2;
    width: calc(var(--content-h) * 0.5625);
    height: 100%;
    border-radius: 8px;
}

.project-offline {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.03);
    padding-left: 40%;
}

.project-offline span {
    font-family: 'Roboto Mono', monospace;
    font-size: 9px;
    letter-spacing: 10px;
    color: rgba(255,255,255,0.2);
    position: relative;
    z-index: 1;
}

.project-card img,
.project-card video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.project-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 24px;
    opacity: 0;
    transition: opacity 0.3s;
}

.project-card:hover .project-overlay { opacity: 1; }

.project-headline {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: clamp(1.4rem, 2.5vw, 2.2rem);
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
}

.project-subline {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: clamp(0.75rem, 1vw, 0.95rem);
    font-weight: 300;
    color: rgba(255,255,255,0.6);
    margin-bottom: 10px;
}

.project-text {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 1.15rem;
    font-weight: 300;
    color: #fff;
    line-height: 1.6;
    margin-bottom: 12px;
}

.project-links {
    display: flex;
    gap: 16px;
}

.project-link {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 0.8rem;
    font-weight: 300;
    color: rgba(255,255,255,0.7);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.2s;
}

.project-link:hover { color: #fff; }

.projects-empty {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.3);
    padding: 40px 0;
}

.projects-empty a {
    color: rgba(255,255,255,0.6);
    text-decoration: underline;
}

.gh-grid-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 120px;
    box-sizing: border-box;
}

.gh-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 80px;
    width: 100%;
    max-width: 1200px;
}

.gh-card {
    border: none;
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-decoration: none;
    color: white;
    transition: background 0.3s, backdrop-filter 0.3s;
    cursor: pointer;
    pointer-events: all;
    height: 180px;
    overflow: hidden;
    box-sizing: border-box;
}

.gh-card:hover {
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.gh-card:hover .gh-card-desc,
.gh-card:hover .gh-card-meta,
.gh-card:hover .gh-card-links {
    opacity: 1;
    max-height: 200px;
}

.gh-card-name {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 1.3rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 1);
    letter-spacing: 0.02em;
}

.gh-card-desc {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.7rem;
    font-weight: 300;
    color: rgba(255, 255, 255, 1);
    line-height: 1.6;
    flex: 1;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.3s, max-height 0.3s;
}

.gh-card-meta {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.75rem;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.5);
    display: flex;
    gap: 12px;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.3s, max-height 0.3s;
}

.gh-card-links {
    display: flex;
    gap: 16px;
    margin-top: 4px;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.3s, max-height 0.3s;
}

.gh-link {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 0.75rem;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: underline;
    text-underline-offset: 3px;
    pointer-events: all;
    transition: color 0.2s;
}

.gh-link:hover {
    color: rgba(255, 255, 255, 1);
}

.gh-error {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.4);
}