:root {
    --primary-color: #0f0;
    --bg-color: #000;
    --glitch-color-1: #0ff;
    --glitch-color-2: #f0f;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--primary-color);
    font-family: 'Share Tech Mono', monospace;
    overflow-x: hidden;
}

body.locked {
    overflow: hidden; /* Scroll lock */
    height: 100vh;
}

#scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        rgba(255,255,255,0),
        rgba(255,255,255,0) 50%,
        rgba(0,0,0,0.2) 50%,
        rgba(0,0,0,0.2)
    );
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 100;
    opacity: 0.6;
}

#hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background: #000;
}

/* Glitch Image Setup */
.glitch-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('top.png');
    background-size: cover;
    background-position: center;
    opacity: 1;
}

/* Base image */
.glitch-image:nth-child(1) {
    z-index: 1;
}

/* Glitch layers (hidden initially, activated by JS or CSS animation) */
.glitch-image:nth-child(n+2) {
    z-index: 2;
    opacity: 0;
    background-blend-mode: hard-light;
}

#system-message {
    z-index: 10;
    text-align: center;
    background: rgba(0, 0, 0, 0.7);
    padding: 2rem;
    border: 1px solid var(--primary-color);
    box-shadow: 0 0 10px var(--primary-color);
    text-shadow: 0 0 5px var(--primary-color);
}

h1 {
    font-size: 3rem;
    margin: 0 0 1rem 0;
    letter-spacing: 0.2em;
}

.blink {
    animation: blink 1s infinite;
}

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

#hack-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
}

#bug-text-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 60;
}

.bug-text {
    position: absolute;
    color: red;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 1.5rem;
    background: #000;
    padding: 2px;
    border: 1px solid red;
    white-space: nowrap;
}

#content {
    display: none; /* Hidden until unlocked */
    padding: 50px;
    background: #111;
    min-height: 100vh;
}

body.unlocked #content {
    display: block;
    animation: fadeIn 2s ease-in;
}

body.unlocked #hero {
    display: none; /* Hide hero after unlock or scroll past */
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Unlocked Content Styles */
body.unlocked {
    background-color: transparent; /* Changed from colored to transparent to see bg-container */
    color: #333;
    overflow-y: auto;
}

#content {
    display: none;
    padding: 0;
    min-height: 100vh;
    color: #333;
    text-align: center;
    position: relative;
    z-index: 10;
    background: transparent; /* Allow fixed bg to show */
}

/* Background Layers */
#bg-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
    background: #fff;
}

.bg-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 1s ease;
}

.bg-layer.active {
    opacity: 1;
}

/* BG Images */
#bg-glass { background-image: url('bg_glass.png'); }
#bg-water { background-image: url('bg_water.png'); }
#bg-iseki { background-image: url('bg_iseki.png'); }



.container {
    max-width: 1100px; /* Widened from 900px */
    margin: 0 auto;
    padding: 50px 20px;
    background: rgba(255, 255, 255, 0.85); /* Semi-transparent white bg for content */
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    border-radius: 8px;
    margin-top: 50px;
}

/* ... existing code ... */

/* Overwrite glitched styles for content area */
.image-wrapper {
    position: relative;
    width: 100%;
    max-width: 660px; /* Reduced from default full width/previous value */
    margin: 50px auto;
    border: 5px solid #fff;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    overflow: hidden;
}

/* ... existing code ... */

/* Responsive ID Video */
.video-container {
    position: relative;
    padding-bottom: 33.75%; /* 16:9 ratio for 60% width (56.25 * 0.6) - actually padding-bottom logic needs to be relative to width. */
    /* Better approach: set max-width and keep padding-top/bottom for aspect ratio */
    width: 60%; /* Display at approx half size relative to container */
    padding-bottom: 33.75%; /* 60% * 56.25% = 33.75% */
    height: 0;
    overflow: hidden;
    margin: 0 auto;
    border: 5px solid #333;
    border-radius: 4px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.section-block {
    margin: 60px 0;
    padding: 20px 0;
    border-bottom: 2px dashed #ccc;
}

.section-block:last-child {
    border-bottom: none;
}

h2 {
    color: #007bff;
    font-size: 2.5rem;
    margin-bottom: 30px;
    border-left: 10px solid #007bff;
    padding-left: 15px;
    display: inline-block;
    width: 100%;
    text-align: left;
    background: linear-gradient(90deg, rgba(0,123,255,0.1), transparent);
}

/* Character Section */
.char-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    gap: 20px;
}

.char-card {
    flex: 1;
    min-width: 300px;
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.char-img-area {
    position: relative;
    width: 100%;
    height: 400px; /* Fixed height for slideshow */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    margin-bottom: 20px;
    background: #eef;
    border-radius: 8px;
}

.char-img {
    position: absolute;
    max-height: 90%;
    max-width: 90%;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.char-img.active {
    opacity: 1;
}

.char-info h3 {
    color: #e91e63;
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.char-info p {
    text-align: left;
    line-height: 1.6;
}

/* Steam & Staff */
.steam-widget-container {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.staff-list {
    list-style: none;
    padding: 0;
    text-align: left;
    max-width: 600px;
    margin: 0 auto;
}

.staff-list li {
    font-size: 1.2rem;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
}

.staff-list li span {
    font-weight: bold;
    color: #333;
}

.footer-spacer {
    height: 50px;
}

footer {
    text-align: center;
    padding: 20px 0;
    margin-top: 20px;
    border-top: 1px solid rgba(0, 255, 0, 0.3);
}

.copyright {
    font-size: 0.9rem;
    color: #666;
    font-family: 'Share Tech Mono', monospace;
    letter-spacing: 1px;
}


/* --- Digital Reveal Effect --- */
.reveal-on-scroll {
    opacity: 0;
    will-change: transform, clip-path, filter;
    visibility: hidden;
}

.reveal-on-scroll.revealed {
    visibility: visible;
    opacity: 1;
    /* Slower animation for "gradual construction" feel */
    animation: digitalConstruct 1.2s cubic-bezier(0.1, 0.9, 0.2, 1) forwards;
}

@keyframes digitalConstruct {
    0% {
        clip-path: inset(0 100% 0 0);
        transform: translateX(-30px);
        filter: blur(8px) grayscale(1) brightness(0.5); /* Low res data feel */
        opacity: 0;
    }
    10% {
        opacity: 1;
        clip-path: inset(0 80% 0 0);
        filter: blur(4px) grayscale(1) brightness(2); /* Bright flash */
        border-right: 2px solid var(--primary-color); /* Scanning line simulation via border */
    }
    30% {
        clip-path: inset(0 50% 0 0);
        transform: translateX(10px);
        filter: blur(2px) hue-rotate(90deg) contrast(1.5);
    }
    50% {
        clip-path: inset(0 20% 0 0);
        transform: translateX(-5px);
        filter: invert(0.1);
    }
    70% {
        clip-path: inset(0 5% 0 0);
        transform: translateX(2px);
        filter: none;
    }
    85% {
        clip-path: inset(0 0 0 0);
        transform: translateX(0);
        opacity: 0.8; /* Flicker */
    }
    90% {
        opacity: 0.4;
    }
    95% {
        opacity: 1;
    }
    100% {
        clip-path: inset(0 0 0 0);
        transform: translateX(0);
        filter: none;
        opacity: 1;
        border-right: none;
    }
}

/* --- Character Image Special Reveal --- */
.revealed .char-img-area {
    position: relative;
    overflow: hidden;
}

/* Default slideshow state */
.char-img {
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.char-img.active {
    opacity: 1;
}

/* Hologram effect override when revealed */
.char-card.revealed .char-img.active {
    opacity: 1; /* Ensure locked to visible */
    animation: hologramConstruct 1s cubic-bezier(0.1, 0.9, 0.2, 1) forwards;
    transition: none; /* Disable transition to let animation take over */
}

@keyframes hologramConstruct {
    0% {
        opacity: 0;
        transform: scaleY(0.1) scaleX(1.5);
        filter: brightness(5) saturate(0);
        clip-path: inset(50% 0 50% 0);
    }
    10% {
        opacity: 1;
        transform: scaleY(0.5) scaleX(1.1);
        clip-path: inset(40% 0 40% 0);
        filter: brightness(3) hue-rotate(90deg);
    }
    30% {
        transform: scaleY(1.05) scaleX(0.95);
        clip-path: inset(0 0 0 0);
        filter: brightness(1.5) hue-rotate(0deg);
    }
    40% {
        transform: scale(1);
        filter: brightness(1.2) contrast(1.2);
        opacity: 0.8;
    }
    45% {
        opacity: 1;
        filter: brightness(1.5);
    }
    50% {
        opacity: 0.9;
    }
    100% {
        opacity: 1;
        transform: scale(1);
        filter: none;
        clip-path: none; /* Remove clip-path completely */
    }
}

/* Character Switch Glitch Effect */
.char-img.glitch-active {
    opacity: 1 !important; /* Force visible */
    transition: none; /* Disable default fade */
    animation: switchGlitch 0.4s steps(5) forwards; /* Steps for digital feel */
}

@keyframes switchGlitch {
    0% {
        opacity: 0;
        clip-path: inset(0 80% 0 0); /* Start cropped */
        transform: translateX(-20px);
        filter: brightness(2) contrast(1.5) hue-rotate(90deg);
    }
    20% {
        opacity: 1;
        clip-path: inset(0 0 0 60%); /* Jump cut */
        transform: translateX(10px);
    }
    40% {
        clip-path: inset(20% 0 20% 0); /* Center strip */
        transform: translateX(-5px);
        filter: invert(0.2);
    }
    60% {
        clip-path: inset(0 0 0 0);
        transform: translateX(2px);
        filter: none;
    }
    80% {
        clip-path: inset(0 10% 50% 10%); /* Random block */
    }
    100% {
        clip-path: none;
        transform: translateX(0);
        filter: none;
        opacity: 1;
    }
}

/* Sequential Delays for list items and cards */
.char-card:nth-child(1) { animation-delay: 0s; }
.char-card:nth-child(2) { animation-delay: 0.2s; }

.staff-list li.revealed:nth-child(1) { animation-delay: 0.05s; }
.staff-list li.revealed:nth-child(2) { animation-delay: 0.1s; }
.staff-list li.revealed:nth-child(3) { animation-delay: 0.15s; }
.staff-list li.revealed:nth-child(4) { animation-delay: 0.2s; }
.staff-list li.revealed:nth-child(5) { animation-delay: 0.25s; }
.staff-list li.revealed:nth-child(6) { animation-delay: 0.3s; }
.staff-list li.revealed:nth-child(7) { animation-delay: 0.35s; }


/* --- Title Slide Reveal Effect --- */
.reveal-slide {
    opacity: 0;
    transform: translateX(-50px); /* Start from left */
    transition: opacity 1s ease-out, transform 1s cubic-bezier(0.19, 1, 0.22, 1);
    will-change: opacity, transform;
    visibility: hidden;
}

.reveal-slide.revealed {
    visibility: visible;
    opacity: 1;
    transform: translateX(0);
}

/* Optional: Add a subtle glow transition to the border-left of h2 if desired */
h2.reveal-slide {
    border-left-color: transparent;
    transition: border-left-color 1s ease 0.5s, opacity 1s ease-out, transform 1s cubic-bezier(0.19, 1, 0.22, 1);
}

h2.reveal-slide.revealed {
    border-left-color: #007bff;
}


/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    /* Hero Section */
    h1 {
        font-size: 2rem; /* Smaller title */
    }
    #system-message {
        width: 90%;
        padding: 1rem;
        box-sizing: border-box;
    }

    /* Main Container */
    .container {
        width: 95%;
        padding: 20px 10px;
        margin-top: 20px;
    }

    /* Section Titles */
    h2 {
        font-size: 1.8rem;
        margin-bottom: 20px;
    }

    /* Text Block */
    .text-block p {
        font-size: 0.9rem; /* Smaller body text */
    }

    /* Character Section: Stack vertically */
    .char-container {
        flex-direction: column;
        align-items: center;
    }
    
    .char-card {
        width: 100%;
        min-width: unset;
        margin-bottom: 20px;
        box-sizing: border-box; /* Include padding in width */
    }

    .char-img-area {
        height: 300px; /* Slightly smaller image area */
    }

    /* Trailer: Full width */
    .video-container {
        width: 100%;
        padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    }

    /* Steam Widget: Scrollable if too wide */
    .steam-widget-container {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Staff List: Stack items */
    .staff-list li {
        flex-direction: column;
        align-items: flex-start;
        font-size: 1rem;
    }
    
    .staff-list li span {
        margin-top: 5px;
        align-self: flex-end; /* Name to the right */
    }
    
    /* Footer */
    .copyright {
        font-size: 0.7rem;
    }
}
