@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');
@import url('https://fonts.googleapis.com/css2?family=Gaegu&display=swap');

@font-face {
    font-family: 'Paperlogy-Medium';
    src: url('https://fastly.jsdelivr.net/gh/projectnoonnu/2412-1@1.0/Paperlogy-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
}

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

body {
    background-color: #0A0A1A;
    color: #FFFFFF;
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
    font-size: 18px; /* 수정: 16px -> 18px (기존 17px) */
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100vw;
    height: 100vh;
    background: radial-gradient(ellipse at center, rgba(200,80,192,0.12) 0%, transparent 70%);
    z-index: -1;
    pointer-events: none;
}

h1 { font-size: 34px; margin-bottom: 20px; } /* 추가: 페이지 타이틀 */
h2 { font-size: 24px; margin-bottom: 15px; } /* 추가: 섹션 타이틀 */
h3 { font-size: 20px; margin-bottom: 10px; } /* 추가: 하위 타이틀 */

h1, h2, h3, .nav-brand {
    font-family: 'Paperlogy-Medium', sans-serif;
}

/* Glassmorphism Components */
.glass-card {
    background: rgba(255,255,255,0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    position: relative;
}

.sub-text {
    color: #A0A0C0;
    text-align: center;
    margin-bottom: 30px;
    font-size: 17px; /* 수정: 14px -> 17px (기존 15px) */
}

.input-group {
    margin-bottom: 20px;
    text-align: left;
    width: 100%;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 15px; /* 수정: 13px -> 15px (기존 14px) */
    color: #A0A0C0;
}

input, select, textarea {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    color: white;
    padding: 14px 18px;
    width: 100%;
    font-size: 17px; /* 수정: 14px -> 17px (기존 16px) */
    font-family: 'Pretendard', sans-serif;
    transition: all 0.3s ease;
}

input:focus, textarea:focus {
    border-color: #C850C0;
    outline: none;
    background: rgba(255,255,255,0.12);
}

.btn-primary {
    background: linear-gradient(135deg, #FF6B8A, #C850C0, #7B68EE);
    border: none;
    border-radius: 12px;
    color: white;
    font-weight: bold;
    padding: 14px 28px;
    cursor: pointer;
    width: 100%;
    font-size: 17px; /* 수정: 14px -> 17px (기존 17px) */
    transition: all 0.3s ease;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(200,80,192,0.3);
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(10, 10, 26, 0.6);
    backdrop-filter: blur(10px);
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-user {
    color: #A0A0C0;
    font-size: 16px; /* 수정: -> 16px (기존 15px) */
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-logout {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #A0A0C0;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 15px; /* 수정: 14px -> 15px */
    cursor: pointer;
}

.hero-section {
    text-align: center;
    margin-top: 120px;
    margin-bottom: 60px;
    width: 100%;
}

/* Step Indicator */
.step-indicator {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 40px;
    font-size: 15px; /* 수정: -> 15px (기존 14px) */
}

.step {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #A0A0C0;
}

.step.active {
    color: #FFFFFF;
    font-weight: bold;
}

.step-dot {
    font-size: 18px;
}

/* Macbook Frame */
.macbook-frame {
    width: 100%;
    max-width: 900px;
    background: #1E1E2E;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(200, 80, 192, 0.15);
    margin: 0 auto 40px;
    overflow: hidden;
}

.macbook-titlebar {
    background: rgba(255, 255, 255, 0.03);
    padding: 12px 16px;
    display: flex;
    gap: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.macbook-dot { width: 12px; height: 12px; border-radius: 50%; }
.dot-red { background: #FF5F56; }
.dot-yellow { background: #FFBD2E; }
.dot-green { background: #27C93F; }

.macbook-content {
    padding: 40px;
}

/* Character/Allies Specific */
.character-grid { display: grid; grid-template-columns: 200px 1fr; gap: 30px; }
@media (max-width: 768px) { .character-grid { grid-template-columns: 1fr; } }

.upload-area {
    width: 100%; max-width: 200px; min-height: 250px;
    border: 2px dashed rgba(255, 255, 255, 0.1); border-radius: 15px;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    cursor: pointer; background: #1E1E2E; transition: all 0.3s; overflow: hidden;
}

.upload-area img { width: 100%; height: 100%; object-fit: contain; }

.rpg-label { display: block; color: #C850C0; font-size: 15px; font-weight: bold; margin-bottom: 5px; } /* 수정: -> 15px (기존 12px) */

.stats-display {
    background: rgba(0, 0, 0, 0.2); border-radius: 12px; padding: 20px;
    margin: 30px 0; display: flex; justify-content: space-around; border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-item { text-align: center; color: #505070; }
.stat-item.active { color: #FFFFFF; }
.stat-value { font-weight: bold; display: block; margin-top: 5px; font-size: 17px; } /* 추가: 17px */

.allies-container { display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; }
.ally-card {
    background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px; padding: 25px; width: 250px; position: relative;
}

/* Story/Outline */
.storyboard-row { display: flex; align-items: center; gap: 20px; margin-bottom: 15px; }
.storyboard-label { width: 80px; color: #C850C0; font-weight: bold; font-size: 15px; } /* 수정: 14px -> 15px */

.story-slot { 
    background: rgba(255, 255, 255, 0.02); 
    border-radius: 15px; 
    padding: 16px; /* 수정: 여백 최소화 */
    margin-bottom: 40px; 
    border: 1px solid rgba(255, 255, 255, 0.05); 
}
.chapter-badge { display: inline-block; background: rgba(200, 80, 192, 0.2); color: #C850C0; padding: 4px 12px; border-radius: 20px; font-size: 15px; font-weight: bold; }

.slot-layout { 
    display: flex; 
    gap: 16px; /* 수정: 간격 축소 */
    margin-top: 20px; 
    align-items: stretch; /* 높이 동기화 */
}

.story-image-area, .story-text-area {
    flex: 1; /* 50:50 비율 */
    min-height: 250px;
}

.story-image-area { 
    border: 2px dashed rgba(255, 255, 255, 0.1); 
    border-radius: 12px; 
    cursor: pointer; 
    background: #1E1E2E; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    overflow: hidden; 
}
.story-image-area img { width: 100%; height: 100%; object-fit: cover; }

.story-text-area textarea {
    width: 100%;
    height: 100%;
    min-height: 230px;
    background: rgba(255, 255, 255, 0.1); /* 배경과 구분되는 색상 */
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: white;
    font-size: 17px; /* 수정: 15px -> 17px */
    line-height: 1.8;
    padding: 16px;
    resize: none;
    transition: all 0.3s ease;
}

.story-text-area textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.story-text-area textarea:focus {
    border-color: #C850C0;
    outline: none;
    background: rgba(255, 255, 255, 0.15);
}

@media (max-width: 768px) { 
    .slot-layout { flex-direction: column; } 
    .story-image-area { width: 100%; height: 250px; }
}

/* Viewer (Real Book) */
.viewer-page-wrapper { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; perspective: 1500px; background: #0A0A1A; }
.book-frame-container { position: relative; margin-bottom: 40px; }
.book-container { width: 900px; height: 600px; position: relative; transform-style: preserve-3d; cursor: pointer; }
.leaf { position: absolute; top: 0; right: 0; width: 50%; height: 100%; transform-origin: left center; transition: transform 0.8s cubic-bezier(0.645, 0.045, 0.355, 1); transform-style: preserve-3d; z-index: 1; }
.leaf.flipped { transform: rotateY(-180deg); }
.page-face { position: absolute; top: 0; left: 0; width: 100%; height: 100%; backface-visibility: hidden; background: #f5f0e8; display: flex; flex-direction: column; overflow: hidden; box-shadow: inset 0 0 30px rgba(0,0,0,0.05); }
.page-face.back { transform: rotateY(180deg); }
.page-image-full { width: 100%; height: 100%; background-color: #f5f0e8; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.page-image-full img { width: 100%; height: 100%; object-fit: contain; }
.page-text-full { flex: 1; padding: 60px 50px; font-family: 'Gaegu', cursive; font-size: 24px; line-height: 1.8; color: #2a2a2a; white-space: pre-wrap; text-align: justify; }
.spine-shadow { position: absolute; top: 0; left: 0; width: 20px; height: 100%; background: linear-gradient(to right, rgba(0,0,0,0.1) 0%, transparent 100%); z-index: 10; pointer-events: none; }

.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    font-size: 36px;
    cursor: pointer;
    transition: color 0.3s;
    z-index: 100;
}
.nav-arrow:hover { color: rgba(255, 255, 255, 0.7); }
.prev-arrow { left: -50px; }
.next-arrow { right: -50px; }

.page-counter { color: #A0A0C0; font-size: 16px; margin-bottom: 20px; }

/* Utils */
.autosave-toast {
    position: fixed; bottom: 30px; right: 30px;
    background: rgba(10, 10, 26, 0.9); border: 1px solid #4FC3F7; color: #4FC3F7;
    padding: 12px 24px; border-radius: 30px; font-size: 15px; /* 수정: 14px -> 15px */
    opacity: 0; transform: translateY(10px); transition: all 0.5s ease; z-index: 3000;
}
.autosave-toast.show { opacity: 1; transform: translateY(0); }

.hidden { display: none !important; }
.btn-disabled { opacity: 0.3; pointer-events: none; }
.error-text { color: #FF6B8A; font-size: 15px; text-align: center; display: none; } /* 수정: 14px -> 15px */

.admin-link { position: absolute; top: -30px; right: 0; color: #A0A0C0; font-size: 15px; text-decoration: none; } /* 수정: 13px -> 15px */
.admin-link:hover { color: #C850C0; }

.gallery-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; margin-top: 50px; }
.story-card { background: rgba(255, 255, 255, 0.05); border-radius: 16px; overflow: hidden; cursor: pointer; transition: all 0.3s; text-align: left; }
.story-card:hover { transform: translateY(-8px); background: rgba(255, 255, 255, 0.08); }
.card-cover { width: 100%; aspect-ratio: 3/4; overflow: hidden; background: #1E1E2E; }
.card-cover img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 20px; }
.card-title { color: white; font-size: 18px; font-weight: 700; margin-bottom: 8px; } /* 수정: 17px -> 18px */
.card-author { color: #A0A0C0; font-size: 15px; } /* 수정: 13px -> 15px */
