/* ========================================
   여명의 아스테리아 - Captain's Log Edition
   새벽별 하늘 + 항해일지 스타일
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Bangers&family=Black+Han+Sans&family=Jua&family=Comic+Neue:wght@400;700&family=Nanum+Pen+Script&family=Single+Day&display=swap');

:root {
    /* 새벽하늘 색상 */
    --sky-deep: #0f0c29;
    --sky-mid: #302b63;
    --sky-purple: #24243e;
    --comet-blue: #00d4ff;
    --comet-pink: #ff6b9d;
    --star-glow: #b8e0ff;
    
    /* 항해일지 색상 */
    --paper: #f4e4bc;
    --paper-dark: #e8d4a8;
    --paper-edge: #d4c49a;
    --ink: #2c1810;
    --ink-light: #4a3728;
    --ink-faded: #6b5344;
    --gold-accent: #c9a227;
    --red-seal: #8b2635;
    
    /* 캐릭터 색상 */
    --pink: #FFB5C5;
    --silver: #C4C9D4;
    --sky: #A8D8EA;
    --gold: #F4D58D;
    
    /* 폰트 */
    --font-title: 'Bangers', 'Black Han Sans', cursive;
    --font-korean: 'Black Han Sans', sans-serif;
    --font-handwriting: 'Nanum Pen Script', 'Single Day', cursive;
    --font-body: 'Jua', sans-serif;
    --font-quote: 'Comic Neue', cursive;
}

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

html { font-size: 16px; }

body {
    min-height: 100vh;
    overflow-x: hidden;
    font-family: var(--font-body);
}

/* ========================================
   새벽별 하늘 배경 (너의 이름은 스타일)
   ======================================== */
.sky-background {
    position: fixed;
    inset: 0;
    z-index: -10;
    background: linear-gradient(
        180deg,
        #0f0c29 0%,
        #1a1a3e 12%,
        #302b63 25%,
        #544a7d 40%,
        #8b5a8c 52%,
        #c97b84 62%,
        #f4a261 75%,
        #e9c46a 88%,
        #f8e5b0 100%
    );
}

/* 혜성 - 메인 */
.comet {
    position: fixed;
    width: 350px;
    height: 4px;
    background: linear-gradient(90deg, 
        transparent 0%,
        rgba(0, 212, 255, 0.2) 20%,
        rgba(0, 212, 255, 0.6) 60%,
        rgba(180, 230, 255, 0.9) 85%,
        #ffffff 100%
    );
    border-radius: 2px;
    z-index: -8;
    animation: cometFall 12s linear infinite;
    filter: drop-shadow(0 0 8px rgba(0, 212, 255, 0.8))
            drop-shadow(0 0 20px rgba(0, 212, 255, 0.5))
            drop-shadow(0 0 40px rgba(0, 212, 255, 0.3));
}

.comet::before {
    content: '';
    position: absolute;
    right: -4px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: radial-gradient(circle, #ffffff 0%, rgba(180,230,255,0.8) 40%, transparent 70%);
    border-radius: 50%;
}

.comet-1 {
    top: 5%;
    right: -400px;
    transform: rotate(32deg);
}

.comet-2 {
    top: 18%;
    right: -400px;
    width: 200px;
    height: 3px;
    transform: rotate(38deg);
    animation-delay: 4s;
    animation-duration: 10s;
    background: linear-gradient(90deg, 
        transparent 0%,
        rgba(255, 107, 157, 0.2) 20%,
        rgba(255, 107, 157, 0.6) 60%,
        rgba(255, 180, 200, 0.9) 85%,
        #ffffff 100%
    );
    filter: drop-shadow(0 0 8px rgba(255, 107, 157, 0.8))
            drop-shadow(0 0 20px rgba(255, 107, 157, 0.5));
}

@keyframes cometFall {
    0% {
        transform: translateX(0) rotate(32deg);
        opacity: 0;
    }
    5% { opacity: 1; }
    95% { opacity: 1; }
    100% {
        transform: translateX(-180vw) rotate(32deg);
        opacity: 0;
    }
}

/* 별들 */
.stars {
    position: fixed;
    inset: 0;
    z-index: -9;
    pointer-events: none;
}

.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    animation: twinkle 3s ease-in-out infinite;
}

.star-1 { width: 3px; height: 3px; top: 8%; left: 15%; animation-delay: 0s; }
.star-2 { width: 2px; height: 2px; top: 12%; left: 75%; animation-delay: 0.5s; }
.star-3 { width: 4px; height: 4px; top: 6%; left: 45%; animation-delay: 1s; }
.star-4 { width: 2px; height: 2px; top: 18%; left: 25%; animation-delay: 1.5s; }
.star-5 { width: 3px; height: 3px; top: 10%; left: 85%; animation-delay: 2s; }
.star-6 { width: 2px; height: 2px; top: 22%; left: 60%; animation-delay: 0.3s; }
.star-7 { width: 3px; height: 3px; top: 4%; left: 35%; animation-delay: 0.8s; }
.star-8 { width: 2px; height: 2px; top: 15%; left: 92%; animation-delay: 1.2s; }

@keyframes twinkle {
    0%, 100% { opacity: 0.4; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.3); }
}

/* 빛나는 별 십자 효과 */
.star-cross {
    position: fixed;
    z-index: -8;
}

.star-cross::before,
.star-cross::after {
    content: '';
    position: absolute;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.8), transparent);
}

.star-cross::before {
    width: 30px;
    height: 2px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.star-cross::after {
    width: 2px;
    height: 30px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.star-cross-1 { top: 20%; left: 50%; animation: starPulse 4s ease-in-out infinite; }
.star-cross-2 { top: 35%; left: 20%; animation: starPulse 4s ease-in-out infinite 1s; }

@keyframes starPulse {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* 구름 - 노을빛 */
.clouds {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    z-index: -7;
    pointer-events: none;
}

.cloud {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
}

.cloud-1 {
    width: 500px;
    height: 200px;
    bottom: 15%;
    left: -15%;
    background: linear-gradient(180deg, 
        rgba(255,255,255,0.85) 0%,
        rgba(255,180,160,0.6) 50%,
        rgba(255,120,100,0.3) 100%
    );
    animation: cloudFloat 25s ease-in-out infinite;
}

.cloud-2 {
    width: 600px;
    height: 220px;
    bottom: 10%;
    right: -20%;
    background: linear-gradient(180deg, 
        rgba(255,255,255,0.8) 0%,
        rgba(255,200,180,0.5) 50%,
        rgba(244,162,97,0.3) 100%
    );
    animation: cloudFloat 30s ease-in-out infinite 5s;
}

.cloud-3 {
    width: 400px;
    height: 150px;
    bottom: 25%;
    left: 25%;
    background: linear-gradient(180deg, 
        rgba(255,255,255,0.7) 0%,
        rgba(255,150,130,0.4) 100%
    );
    animation: cloudFloat 20s ease-in-out infinite 10s;
    opacity: 0.7;
}

@keyframes cloudFloat {
    0%, 100% { transform: translateX(0) translateY(0); }
    50% { transform: translateX(30px) translateY(-15px); }
}

/* ========================================
   메인 래퍼
   ======================================== */
.wrap {
    max-width: 520px;
    margin: 0 auto;
    padding: 24px 16px 60px;
    animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   항해일지 - 메인 컨테이너
   ======================================== */
.logbook {
    background: 
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='paper'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.04' numOctaves='5' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23paper)' opacity='0.06'/%3E%3C/svg%3E"),
        linear-gradient(135deg, var(--paper) 0%, var(--paper-dark) 100%);
    border-radius: 6px 12px 12px 6px;
    box-shadow: 
        4px 4px 15px rgba(0,0,0,0.4),
        0 0 0 1px rgba(0,0,0,0.1),
        inset 0 1px 0 rgba(255,255,255,0.4);
    position: relative;
    overflow: hidden;
}

/* 가죽 바인딩 */
.logbook::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 28px;
    background: 
        linear-gradient(90deg, 
            #4a3525 0%,
            #5c4033 20%,
            #6b4c3a 50%,
            #5c4033 80%,
            #4a3525 100%
        );
    box-shadow: 
        inset -3px 0 6px rgba(0,0,0,0.4),
        3px 0 8px rgba(0,0,0,0.2);
}

/* 바인딩 장식 (스티치) */
.logbook::after {
    content: '';
    position: absolute;
    left: 22px;
    top: 10px;
    bottom: 10px;
    width: 2px;
    background: repeating-linear-gradient(
        180deg,
        transparent 0px,
        transparent 8px,
        #c9a227 8px,
        #c9a227 16px
    );
    opacity: 0.6;
}

.logbook-inner {
    padding: 24px 24px 24px 48px;
    position: relative;
    min-height: 500px;
}

/* ========================================
   헤더
   ======================================== */
.header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--ink-faded);
    position: relative;
}

.compass-icon {
    font-size: 36px;
    margin-bottom: 12px;
    display: block;
    animation: gentleSpin 30s linear infinite;
}

@keyframes gentleSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.header-subtitle {
    font-family: var(--font-handwriting);
    font-size: 20px;
    color: var(--ink-faded);
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.header-title {
    font-family: var(--font-korean);
    font-size: clamp(26px, 7vw, 34px);
    color: var(--ink);
    letter-spacing: 3px;
    text-shadow: 1px 1px 0 rgba(255,255,255,0.5);
    margin-bottom: 6px;
}

.header-date {
    font-family: var(--font-handwriting);
    font-size: 16px;
    color: var(--ink-faded);
    font-style: italic;
}

/* 잉크 얼룩 */
.ink-stain {
    position: absolute;
    background: radial-gradient(ellipse, rgba(44,24,16,0.15) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.ink-stain-1 {
    width: 40px;
    height: 25px;
    top: 8px;
    right: 15px;
    transform: rotate(-20deg);
}

.ink-stain-2 {
    width: 25px;
    height: 35px;
    bottom: 10px;
    left: 60px;
    transform: rotate(15deg);
}

/* ========================================
   슬라이드
   ======================================== */
.slide {
    display: none;
    opacity: 0;
}

.slide.active {
    display: block;
    opacity: 1;
    animation: pageFlip 0.5s ease-out;
}

@keyframes pageFlip {
    0% { opacity: 0; transform: translateX(20px); }
    100% { opacity: 1; transform: translateX(0); }
}

/* ========================================
   선원 카드 (캐릭터)
   ======================================== */
.crew-card {
    position: relative;
    padding: 20px;
    margin-bottom: 16px;
}

/* 뱃지 */
.crew-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    background: var(--ink);
    color: var(--paper);
    border-radius: 3px;
    font-family: var(--font-body);
    font-size: 12px;
    margin-bottom: 16px;
    box-shadow: 2px 2px 0 rgba(0,0,0,0.2);
}

/* 사진 프레임 */
.photo-frame {
    width: 150px;
    height: 150px;
    margin: 0 auto 16px;
    background: #fff;
    padding: 8px;
    border-radius: 3px;
    box-shadow: 
        0 3px 10px rgba(0,0,0,0.25),
        inset 0 0 30px rgba(0,0,0,0.03);
    transform: rotate(-1.5deg);
    position: relative;
}

.photo-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 2px;
}

.photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e8d4a8, #d4c49a);
    color: var(--ink-faded);
    font-size: 48px;
    border-radius: 2px;
}

/* 이름 */
.crew-name-en {
    font-family: var(--font-title);
    font-size: clamp(20px, 5vw, 26px);
    color: var(--ink);
    text-align: center;
    letter-spacing: 2px;
    margin-bottom: 4px;
    text-shadow: 1px 1px 0 rgba(255,255,255,0.5);
}

.crew-name-kr {
    font-family: var(--font-handwriting);
    font-size: 20px;
    color: var(--ink-light);
    text-align: center;
    margin-bottom: 6px;
}

.crew-title {
    font-family: var(--font-body);
    font-size: 13px;
    text-align: center;
    margin-bottom: 20px;
    padding: 4px 12px;
    display: inline-block;
    width: 100%;
}

/* 캐릭터별 타이틀 색상 */
.astera-card .crew-title { color: #d4849a; }
.rosinante-card .crew-title { color: #8b9dc3; }
.enel-card .crew-title { color: #5ba3b8; }
.tesoro-card .crew-title { color: #c9a227; }

/* 스탯 */
.log-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
    padding: 0 10px;
}

.log-stat {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-bottom: 6px;
    border-bottom: 1px dotted var(--ink-faded);
}

.log-stat-label {
    font-family: var(--font-handwriting);
    font-size: 16px;
    color: var(--ink-faded);
}

.log-stat-value {
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--ink);
}

/* 인용문 */
.crew-quote {
    background: rgba(255,255,255,0.6);
    padding: 14px 18px;
    border-radius: 6px;
    margin-bottom: 14px;
    font-family: var(--font-quote);
    font-size: 15px;
    font-weight: 700;
    color: var(--ink-light);
    text-align: center;
    position: relative;
    border-left: 4px solid var(--gold-accent);
}

.astera-card .crew-quote { border-left-color: var(--pink); color: #8b4a5a; }
.rosinante-card .crew-quote { border-left-color: var(--silver); color: #5a6478; }
.enel-card .crew-quote { border-left-color: var(--sky); color: #3a6878; }
.tesoro-card .crew-quote { border-left-color: var(--gold); color: #7a6020; }

/* 설명 */
.crew-desc {
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--ink-faded);
    line-height: 1.8;
    text-align: center;
}

/* ========================================
   네비게이션
   ======================================== */
.nav-fixed {
    position: fixed;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 8px;
    pointer-events: none;
    z-index: 1000;
    max-width: 600px;
    margin: 0 auto;
}

.nav-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--paper-edge);
    background: linear-gradient(145deg, var(--paper), var(--paper-dark));
    color: var(--ink);
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    pointer-events: auto;
    box-shadow: 
        2px 3px 8px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.5);
}

.nav-btn:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 3px 4px 12px rgba(0,0,0,0.4);
}

.nav-btn:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

/* ========================================
   페이지 인디케이터
   ======================================== */
.page-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px dashed var(--ink-faded);
}

.page-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--ink-faded);
    opacity: 0.25;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.page-dot.active {
    opacity: 1;
    background: var(--gold-accent);
    transform: scale(1.2);
    box-shadow: 0 0 8px rgba(201, 162, 39, 0.5);
}

.page-num {
    font-family: var(--font-handwriting);
    font-size: 18px;
    color: var(--ink-faded);
    margin-left: 12px;
}

/* ========================================
   푸터
   ======================================== */
.footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 16px;
}

.footer-text {
    font-family: var(--font-handwriting);
    font-size: 18px;
    color: var(--ink-light);
    margin-bottom: 10px;
}

.footer-symbols {
    display: flex;
    justify-content: center;
    gap: 12px;
    font-size: 16px;
    color: var(--gold-accent);
}

/* ========================================
   반응형
   ======================================== */
@media (max-width: 480px) {
    .wrap {
        padding: 16px 10px 50px;
    }
    
    .logbook-inner {
        padding: 20px 16px 20px 40px;
    }
    
    .logbook::before {
        width: 24px;
    }
    
    .header-title {
        font-size: clamp(22px, 6vw, 28px);
    }
    
    .photo-frame {
        width: 130px;
        height: 130px;
    }
    
    .nav-btn {
        width: 44px;
        height: 44px;
        font-size: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}