body,
html {
    margin: 0;
    padding: 0;
    height: 400vh;
    overflow-x: hidden;
    background: linear-gradient(to bottom, #110022 0%, #3a0022 40%, #7d1128 70%, #d44a27 100%);
    background-attachment: fixed;
    font-family: 'Noto Sans KR', 'Malgun Gothic', sans-serif;
}

/* ===== 건물 레이어 ===== */
.layer {
    position: fixed;
    bottom: 0;
    left: -100vw; /* 화면 밖 양옆에 동일한 여유를 주기 위해 -100vw부터 시작 */
    width: 300vw; /* 총 300vw 너비로 화면 양옆을 충분히 덮어줌 (균등 정렬) */
    display: flex;
    align-items: flex-end;
}

.layer div {
    margin: 0px;
    position: relative;
    overflow: hidden;
}

.layer-back {
    z-index: 10;
    height: 100vh;
}
.layer-back div {
    background: linear-gradient(to bottom, #6a3b13, #2a1505);
}

.layer-middle {
    z-index: 20;
    height: 100vh;
}
.layer-middle div {
    background: linear-gradient(to bottom, #885203, #382000);
}

.layer-front {
    z-index: 30;
    height: 100vh;
}
.layer-front div {
    background: linear-gradient(to bottom, #df9912, #5a3a00);
}

/* ===== 별똥별 ===== */
.shooting-star {
    position: fixed;
    width: 3px;
    height: 100px;
    border-radius: 2px;
    z-index: 5;
    filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.8));
    animation: shooting linear forwards;
}

@keyframes shooting {
    0% {
        transform: translate(0, 0) rotate(-90deg);
        opacity: 1;
    }
    100% {
        transform: translate(-1500px, 1500px) rotate(-150deg);
        opacity: 0;
    }
}

/* ===== 창문 패턴 ===== */
.window-type-1::after {
    content: '';
    position: absolute;
    top: 5%; left: 10%; right: 10%; bottom: 0;
    opacity: 0.4;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 220, 100, 0.5) 2px, transparent 2px),
        linear-gradient(90deg, rgba(255, 220, 100, 0.5) 2px, transparent 2px);
    background-size: 10px 15px;
}
.window-type-2::after {
    content: '';
    position: absolute;
    top: 5%; left: 10%; right: 10%; bottom: 0;
    opacity: 0.4;
    pointer-events: none;
    background-image: repeating-linear-gradient(
        to bottom,
        transparent, transparent 15px,
        rgba(255, 200, 50, 0.3) 15px,
        rgba(255, 200, 50, 0.3) 25px
    );
}
.window-type-3::after {
    content: '';
    position: absolute;
    top: 5%; left: 10%; right: 10%; bottom: 0;
    opacity: 0.4;
    pointer-events: none;
    background-image: repeating-linear-gradient(
        90deg,
        transparent, transparent 10px,
        rgba(255, 180, 0, 0.4) 10px,
        rgba(255, 180, 0, 0.4) 15px
    );
}
.window-type-4::after {
    content: '';
    position: absolute;
    top: 5%; left: 10%; right: 10%; bottom: 0;
    opacity: 0.4;
    pointer-events: none;
    background-image:
        repeating-linear-gradient(transparent, transparent 30px, rgba(255, 255, 150, 0.2) 30px, rgba(255, 255, 150, 0.2) 40px),
        repeating-linear-gradient(90deg, transparent, transparent 20px, rgba(255, 255, 150, 0.2) 20px, rgba(255, 255, 150, 0.2) 30px);
}

/* =========================================
   엘리베이터 시스템
   ========================================= */
.elevator-cables {
    position: fixed;
    top: 0; left: 50%;
    transform: translateX(-50%);
    width: 96px; /* 엘리베이터 크기에 맞춘 와이어 간격 더욱 증가 */
    height: 100vh;
    z-index: 35; /* 건물 뒤, 섹션 뒤쪽 */
    pointer-events: none;
}
.elevator-cables .cable {
    position: absolute;
    top: 0; bottom: 0;
    width: 3px;
    background: linear-gradient(to right, #2a2a2a, #888, #2a2a2a);
    box-shadow: 0 0 5px rgba(0,0,0,0.8);
}
.elevator-cables .cable.left { left: 0; }
.elevator-cables .cable.right { right: 0; }

.elevator-container {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%); /* 정확히 정중앙 */
    z-index: 100; /* 클릭을 위해 항상 위로 */
}

.elevator-car {
    position: relative;
    width: 100px; /* 대폭 확대 */
    height: 140px; /* 대폭 확대 */
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8), inset 0 0 10px rgba(0,0,0,0.8);
    background: #111;
    border: 3px solid #333;
    border-radius: 4px;
    /* overflow: hidden; 삭제해서 스파크가 엘리베이터 밖으로도 보이게 수정 */
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), border-color 0.3s;
}
.elevator-car:hover {
    transform: scale(1.05); /* 마우스 올렸을 때 액션 */
    border-color: #ff9d00;
}

/* 내부 배경 및 위 화살표/층수 */
.elevator-inside {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to bottom, #222, #000);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden; /* 문 등 내부 컨텐츠가 테두리를 넘지 않게 처리 */
}
.elevator-floor {
    color: #ffaa00;
    font-size: 0.95rem; /* 글씨 좀 더 크게 */
    font-weight: bold;
    letter-spacing: 1px;
    margin-bottom: -2px;
    font-family: 'Courier New', Courier, monospace;
}
.elevator-arrow {
    color: #ff9d00;
    font-size: 2.2rem; /* 화살표 더욱 크게 */
    animation: flash 1.5s infinite alternate;
}
@keyframes flash {
    0% { opacity: 0.2; text-shadow: none; }
    100% { opacity: 1; text-shadow: 0 0 10px #ff9d00; }
}

/* 금속재질의 좌우 문 */
.elevator-door {
    position: absolute;
    top: 0; bottom: 0;
    width: 50%;
    background: linear-gradient(135deg, #666 0%, #bbb 50%, #555 100%);
    border-left: 1px solid #444;    border-right: 1px solid #444;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 0 5px rgba(255,255,255,0.4);
}
.elevator-door.door-left {
    left: 0;
    transform-origin: left;
}
.elevator-door.door-right {
    right: 0;
    transform-origin: right;
}

/* 문 열림 상태 클래스 (JS를 통해 부여) */
.elevator-car.open .door-left,
.elevator-car.open .door-right {
    transform: scaleX(0.05); /* 문이 얇게 접힘 */
}

/* ===== 엘리베이터 불꽃 이펙트 ===== */
.elevator-spark {
    position: absolute;
    width: 1.5px;
    height: var(--spark-length, 20px);
    background: linear-gradient(to bottom, transparent, #ffcc00, #ff8800);
    pointer-events: none;
    z-index: 200;
    /* 중심점을 한강 가장자리로 두어 선이 그어지듯 스파크가 생기게 */
    transform-origin: top center;
    animation: spark-anim forwards cubic-bezier(0.25, 0.46, 0.45, 0.94);
    filter: drop-shadow(0 0 5px #ff6600);
}

@keyframes spark-anim {
    0% { transform: translate(0, 0) scaleY(1); opacity: 1; }
    100% { transform: translate(var(--tx), var(--ty)) scaleY(0.1); opacity: 0; }
}

/* ===== 스크롤 섹션 컨테이너 ===== */
#scroll-sections {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 400vh;
    z-index: 50;
    pointer-events: none;
}

/* ===== 각 섹션 ===== */
.content-section {
    position: fixed; /* sticky 대신 fixed 사용 (화면에 직접 고정) */
    top: 0;
    left: 0;
    width: 100%; /* 100vw로 할 경우 스크롤바 너비로 인해 왼쪽으로 치우치는 현상 발생 방지 */
    height: 100vh;
    display: flex;
    align-items: center;
    pointer-events: none;
    box-sizing: border-box; /* 패딩 포함 크기 계산 */
}

.content-section[data-align="left"] {
    justify-content: flex-start;
    padding-left: max(2vw, 15px); /* 벽 양옆으로 바싹 붙도록 최소 여백만 줌 */
}
.content-section[data-align="right"] {
    justify-content: flex-end;
    padding-right: max(2vw, 15px); /* 벽 양옆으로 바싹 붙도록 최소 여백만 줌 */
}
.content-section[data-align="center"] {
    justify-content: center;
    padding: 0 max(4vw, 24px);
}

/* ===== 섹션 내부 박스 ===== */
.section-inner {
    /* 좁은 화면에선 최대 500px, 넓은 화면에선 뷰포트 대비 35% 폭 사용 */
    max-width: min(500px, 38vw);
    width: 100%;
    color: #fff;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 1);
    pointer-events: none;
    
    /* 가독성을 높이기 위한 글래스모피즘 효과 배경 */
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 35px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);

    opacity: 0;
    transform: translateY(40px) scale(0.97);
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

/* 왼쪽에서 들어오는 섹션 */
.content-section[data-align="left"] .section-inner {
    transform: translateX(-60px) scale(0.97);
}

/* 오른쪽에서 들어오는 섹션 */
.content-section[data-align="right"] .section-inner {
    transform: translateX(60px) scale(0.97);
}

/* 아래에서 들어오는 섹션 (center) */
.content-section[data-align="center"] .section-inner {
    transform: translateY(120px) scale(0.97); /* 기본값 (엘리베이터 아래) */
}

/* JS에서 visible 클래스가 붙으면 나타남 */
.section-inner.visible {
    opacity: 1;
    transform: translateX(0) translateY(0) scale(1);
    pointer-events: auto;
}

/* 엘리베이터(정중앙 고정) 구역 확보를 위해 가운데 정렬 섹션은 약간 위쪽으로 올려 배치 */
.content-section[data-align="center"] .section-inner.visible {
    transform: translateX(0) translateY(-140px) scale(1);
}

/* 사라지는 상태 (위로 지나갔을 때) */
.section-inner.fade-out-left {
    opacity: 0;
    transform: translateX(-80px) scale(0.95);
}
.section-inner.fade-out-right {
    opacity: 0;
    transform: translateX(80px) scale(0.95);
}
.section-inner.fade-out-up {
    opacity: 0;
    transform: translateY(-120px) scale(0.95);
}
.content-section[data-align="center"] .section-inner.fade-out-up {
    transform: translateY(-200px) scale(0.95);
}

/* ===== 텍스트 요소들 ===== */
.logo-text {
    font-size: clamp(2.2rem, 4.5vw, 5.5rem);
    font-weight: 900;
    margin: 0 0 5px;
    letter-spacing: 3px;
    color: #ff9d00; /* 주황색 테마 */
    text-shadow: 0 0 25px rgba(255, 157, 0, 0.6), 0 2px 10px rgba(0,0,0,0.9);
}

.tagline {
    font-size: clamp(0.95rem, 1.3vw, 1.4rem);
    opacity: 0.8;
    margin: 8px 0 20px;
}

/* ===== 인트로 오버레이 (블러 + 시작 화면 안내) ===== */
.intro-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(17, 0, 34, 0.65); /* 하늘 색상보다 살짝 더 어두운 톤 */
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none; /* 클릭 안 막게, 그냥 보이기만 */
    transition: opacity 1.5s cubic-bezier(0.22, 1, 0.36, 1), 
                visibility 1.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.intro-content p {
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    color: #ff9d00;
    font-weight: 700;
    letter-spacing: 2px;
    text-shadow: 0 0 25px rgba(255, 157, 0, 0.8), 0 2px 5px rgba(0,0,0,1);
    animation: pulse 2s infinite ease-in-out;
    margin: 0;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.05); opacity: 1; }
}

h2 {
    font-size: clamp(1.4rem, 2.5vw, 2.8rem);
    font-weight: 700;
    margin: 0 0 10px;
    color: #ff9d00;
    letter-spacing: 1px;
}

.divider {
    width: 60px;
    height: 2px;
    background: rgba(255, 255, 255, 0.35);
    margin: 18px 0;
}

p {
    font-size: clamp(0.85rem, 1.1vw, 1.1rem);
    line-height: 1.85;
    margin: 0 0 14px;
}

strong {
    color: #ff9d00;
}

.feature-list {
    list-style: none;
    padding: 0;
    margin: 10px 0 20px;
}
.feature-list li {
    font-size: clamp(0.8rem, 1vw, 1rem);
    padding: 5px 0 5px 16px;
    position: relative;
    opacity: 0.85;
}
.feature-list li::before {
    content: '-';
    position: absolute;
    left: 0;
    color: #ff9d00;
}

.bar-subtitle {
    font-size: 1rem;
    color: #ff9d00;
    margin-bottom: 10px;
}

.bar-poem {
    font-size: 0.9rem;
    line-height: 2;
    opacity: 0.65;
    font-style: italic;
    border-left: 2px solid rgba(255, 157, 0, 0.4);
    padding-left: 14px;
    margin: 16px 0;
}

.server-info {
    font-size: 0.85rem;
    opacity: 0.6;
    margin-top: 10px;
}

.footer-text {
    font-size: 0.88rem;
    line-height: 2;
    opacity: 0.65;
    margin-bottom: 24px;
}

/* ===== 버튼들 ===== */
.join-btn {
    display: inline-block;
    padding: 13px 32px;
    background: rgba(255, 157, 0, 0.15);
    border: 1.5px solid rgba(255, 157, 0, 0.6);
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
    border-radius: 4px;
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
}
.join-btn:hover {
    background: rgba(255, 157, 0, 0.3);
    border-color: #ff9d00;
    box-shadow: 0 0 20px rgba(255, 157, 0, 0.4);
    color: #ff9d00;
}

.btn-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.sub-btn {
    display: inline-block;
    padding: 10px 24px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ccc;
    text-decoration: none;
    font-size: 0.88rem;
    border-radius: 4px;
    transition: all 0.25s ease;
}
.sub-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.6);
}
.sub-btn.outline {
    background: transparent;
    border-color: rgba(255, 157, 0, 0.4);
    color: #aaa;
}
.sub-btn.outline:hover {
    border-color: #ff9d00;
    color: #ff9d00;
}

/* =========================================
   반응형 미디어 쿼리
   스크롤은 아래(bottom)부터 시작함을 고려
   ========================================= */

/* --- 초광폭 모니터 (21:9, 2560px+) --- */
@media (min-width: 2000px) {
    .section-inner {
        /* 초광폭에서 최대 폭을 더 넓게 허용 */
        max-width: min(720px, 32vw);
    }
    .content-section[data-align="left"] {
        padding-left: max(4vw, 40px);
    }
    .content-section[data-align="right"] {
        padding-right: max(4vw, 40px);
    }
    .divider { width: 80px; }
}

/* --- 넓은 일반 모니터 (1600px ~ 2000px) --- */
@media (min-width: 1600px) and (max-width: 1999px) {
    .section-inner {
        max-width: min(560px, 36vw);
    }
}

/* --- 태블릿 (768px ~ 1199px) --- */
@media (max-width: 1199px) {
    .section-inner {
        max-width: min(480px, 80vw);
    }
    .content-section[data-align="left"] {
        padding-left: max(5vw, 24px);
    }
    .content-section[data-align="right"] {
        padding-right: max(5vw, 24px);
    }
}

/* --- 스마트폰 (최대 767px) --- */
@media (max-width: 767px) {
    body, html {
        height: 600vh; /* 모바일은 섹션당 더 길게 */
    }

    .section-inner {
        max-width: 90vw;
    }

    /* 모바일은 좌/우 구분 없이 모두 중앙 정렬 */
    .content-section[data-align="left"],
    .content-section[data-align="right"] {
        justify-content: center;
        padding-left: 5vw;
        padding-right: 5vw;
    }

    /* 모바일에서 슬라이드 대신 위/아래 페이드인으로 통일 */
    .content-section[data-align="left"] .section-inner,
    .content-section[data-align="right"] .section-inner {
        transform: translateY(40px) scale(0.97);
    }
    .section-inner.fade-out-left,
    .section-inner.fade-out-right {
        transform: translateY(-50px) scale(0.95);
    }

    .logo-text { font-size: clamp(2rem, 10vw, 3rem); }
    h2 { font-size: clamp(1.3rem, 6vw, 2rem); }
    p { font-size: clamp(0.88rem, 3.5vw, 1rem); }

    .join-btn, .sub-btn {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }
    .btn-row {
        flex-direction: column;
    }

    /* 모바일 환경: 엘리베이터 우측 하단 배치 */
    .elevator-cables {
        display: none; /* 스마트폰에서는 와이어 제거 */
    }
    .elevator-container {
        top: auto;
        bottom: 20px;
        left: auto;
        right: 20px;
        transform: none; /* 중앙정렬 풀기 */
    }
    .elevator-car {
        width: 76px;
        height: 110px;
        background: rgba(17, 17, 17, 0.9);
        backdrop-filter: blur(5px);
    }
}

/* --- 아주 작은 스마트폰 (최대 400px) --- */
@media (max-width: 400px) {
    .logo-text { font-size: 2rem; letter-spacing: 1px; }
    h2 { font-size: 1.3rem; }
    p { font-size: 0.88rem; }
}