/* =========================================================
   anomaly-life — 베이스 CSS (파스텔 + 디저트 톤)
   ========================================================= */

/* ---------- CSS 변수 (테마) ---------- */
:root {
    /* 파스텔 베이스 */
    --bg-cream: #fff8f0;
    --bg-soft: #fdf2e9;
    --bg-card: #ffffff;

    /* 디저트 액센트 */
    --accent-strawberry: #ff8fa3;
    --accent-caramel: #d4a574;
    --accent-matcha: #a8c69f;
    --accent-blueberry: #8aa9d6;

    /* 텍스트 */
    --text-main: #3d2e2e;
    --text-soft: #7a6a6a;
    --text-mute: #b5a5a5;

    /* 보더·그림자 */
    --border-soft: #f0e0d0;
    --shadow-soft: 0 2px 12px rgba(220, 180, 150, 0.18);
    --shadow-hover: 0 6px 24px rgba(220, 180, 150, 0.28);

    /* 라운드·간격 */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 24px;
    --gap-sm: 8px;
    --gap-md: 16px;
    --gap-lg: 32px;
}

/* ---------- 글로벌 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

@import url('https://fonts.googleapis.com/css2?family=Gowun+Dodum&family=Gaegu:wght@400;700&family=Noto+Sans+KR:wght@300;400;500;700&display=swap');

body {
    font-family: 'Noto Sans KR', 'Gowun Dodum', sans-serif;
    background-color: var(--bg-cream);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main { flex: 1; }

a {
    color: var(--accent-strawberry);
    text-decoration: none;
    transition: color 0.2s;
}
a:hover { color: var(--accent-caramel); }

h1, h2, h3, h4 {
    font-family: 'Gaegu', 'Noto Sans KR', sans-serif;
    color: var(--text-main);
    line-height: 1.3;
}

h1 { font-size: 2.4rem; }
h2 { font-size: 1.9rem; }
h3 { font-size: 1.4rem; }
h4 { font-size: 1.15rem; }

p { margin-bottom: var(--gap-sm); }

/* ---------- 컨테이너 ---------- */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--gap-md);
}

.section {
    padding: var(--gap-lg) 0;
}

.section-title {
    text-align: center;
    margin-bottom: var(--gap-lg);
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: var(--accent-strawberry);
    border-radius: 2px;
    margin: var(--gap-sm) auto 0;
}

/* ---------- 헤더 (탭 디자인) ---------- */
.site-header {
    background: var(--bg-card);
    box-shadow: var(--shadow-soft);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0;
    border-bottom: 1px solid var(--border-soft);
}

/* 브랜드 줄 */
.site-header .container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding-top: var(--gap-sm);
    padding-bottom: 0;
}

.site-header .container > div:first-child {
    display: flex;
    align-items: baseline;
    padding: var(--gap-sm) 0 var(--gap-sm);
}

.brand {
    font-family: 'Gaegu', sans-serif;
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--accent-strawberry);
    text-decoration: none;
}

.brand:hover {
    color: var(--accent-caramel);
}

.brand-sub {
    font-size: 0.85rem;
    color: var(--text-mute);
    margin-left: var(--gap-sm);
}

/* 탭 바 */
.nav-list {
    list-style: none;
    display: flex;
    gap: 2px;
    border-bottom: 2px solid var(--border-soft);
    margin: 0;
    padding: 0;
}

.nav-list > li {
    position: relative;
}

/* 각 탭 */
.nav-list > li > a {
    display: inline-block;
    color: var(--text-soft);
    font-weight: 500;
    padding: 12px 22px;
    background: var(--bg-soft);
    border: 1px solid var(--border-soft);
    border-bottom: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    margin-bottom: -2px;
    transition: all 0.18s;
    white-space: nowrap;
    position: relative;
}

.nav-list > li > a:hover {
    background: var(--bg-cream);
    color: var(--accent-strawberry);
}

/* 활성 탭 — 페이지와 연결된 느낌 */
.nav-list > li > a.active {
    background: var(--bg-card);
    color: var(--accent-strawberry);
    border-color: var(--border-soft);
    border-top: 3px solid var(--accent-strawberry);
    padding-top: 10px;
    z-index: 2;
}

.nav-list > li > a.active::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 2px;
    background: var(--bg-card);
}

.caret {
    font-size: 0.7rem;
    margin-left: 4px;
    opacity: 0.7;
}

/* 헤더 탭 — 외부 링크 (캐릭터챗) 강조 */
.nav-list > li > a.nav-external {
    background: linear-gradient(135deg, var(--accent-strawberry), var(--accent-caramel)) !important;
    color: white !important;
    border-color: transparent !important;
    font-weight: 700 !important;
}
.nav-list > li > a.nav-external:hover {
    background: linear-gradient(135deg, var(--accent-caramel), var(--accent-strawberry)) !important;
    color: white !important;
}

/* ---------- 드롭다운 메뉴 ---------- */
.has-dropdown > .dropdown {
    list-style: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 0 var(--radius-md) var(--radius-md) var(--radius-md);
    box-shadow: var(--shadow-hover);
    padding: var(--gap-sm) 0;
    margin-top: 4px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.18s, transform 0.18s, visibility 0.18s;
    z-index: 200;
}

.has-dropdown:hover > .dropdown,
.has-dropdown:focus-within > .dropdown,
.has-dropdown.open > .dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown li {
    list-style: none;
}

.dropdown a {
    display: block;
    width: 100%;
    padding: 8px 16px;
    border-radius: 0;
    color: var(--text-soft);
    font-weight: 400;
    white-space: nowrap;
}

.dropdown a:hover {
    background: var(--bg-soft);
    color: var(--accent-strawberry);
}

/* 호버 갭 누락 방지용 안전선 */
.has-dropdown > a::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -6px;
    height: 6px;
}

/* ---------- 모바일 햄버거 ---------- */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.6rem;
    color: var(--text-soft);
    cursor: pointer;
    align-self: center;
    position: absolute;
    right: var(--gap-md);
    top: var(--gap-md);
}

@media (max-width: 900px) {
    .site-header .container > div:first-child {
        padding-right: 50px;
    }
    .nav-toggle { display: block; }
    .nav-list {
        display: none;
        flex-direction: column;
        gap: 0;
        border-bottom: none;
        padding: 0;
        background: var(--bg-soft);
    }
    .nav-list.open { display: flex; }
    .nav-list > li { width: 100%; }
    .nav-list > li > a {
        display: block;
        width: 100%;
        padding: 12px 16px;
        background: transparent;
        border: none;
        border-bottom: 1px solid var(--border-soft);
        border-radius: 0;
        margin-bottom: 0;
    }
    .nav-list > li > a.active {
        background: var(--bg-card);
        border-top: none;
        border-left: 3px solid var(--accent-strawberry);
        padding-left: 13px;
        padding-top: 12px;
    }
    .nav-list > li > a.active::after { display: none; }

    .has-dropdown > .dropdown {
        position: static;
        box-shadow: none;
        background: var(--bg-cream);
        margin: 0;
        padding: 4px 0 4px 16px;
        opacity: 1;
        visibility: visible;
        transform: none;
        display: none;
        border: none;
        border-radius: 0;
    }
    .has-dropdown.open > .dropdown { display: block; }
    .has-dropdown > a > .caret { float: right; }
}

/* ---------- 푸터 ---------- */
.site-footer {
    background: var(--bg-soft);
    color: var(--text-mute);
    text-align: center;
    padding: var(--gap-md);
    margin-top: var(--gap-lg);
    font-size: 0.9rem;
}

/* ---------- 카드 ---------- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    padding: var(--gap-md);
    transition: transform 0.25s, box-shadow 0.25s;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

/* ---------- 그리드 ---------- */
.grid {
    display: grid;
    gap: var(--gap-md);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
    .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ---------- 버튼 ---------- */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    background: var(--accent-strawberry);
    color: white;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:hover {
    background: var(--accent-caramel);
    color: white;
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--accent-strawberry);
    border: 2px solid var(--accent-strawberry);
}

.btn-outline:hover {
    background: var(--accent-strawberry);
    color: white;
}

/* 캐릭터챗 플레이 버튼 (강조) */
.btn-play {
    background: linear-gradient(135deg, var(--accent-strawberry), var(--accent-caramel));
    color: white;
    font-weight: 700;
    padding: 12px 24px;
    box-shadow: 0 4px 14px rgba(255, 143, 163, 0.4);
}
.btn-play:hover {
    background: linear-gradient(135deg, var(--accent-caramel), var(--accent-strawberry));
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 143, 163, 0.5);
}

/* BGM 컨트롤 (토글 + 볼륨, 모든 페이지 우상단 고정) */
.bgm-control {
    position: fixed;
    top: 14px;
    right: 16px;
    z-index: 200;
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    border: 2px solid var(--accent-strawberry);
    border-radius: 999px;
    padding: 3px 8px 3px 3px;
    box-shadow: var(--shadow-soft);
    transition: all 0.25s;
}

.bgm-toggle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--accent-strawberry);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}
.bgm-toggle:hover {
    background: rgba(255, 143, 163, 0.15);
}
.bgm-toggle.playing {
    background: var(--accent-strawberry);
    color: white;
}
.bgm-control:has(.bgm-toggle.playing) {
    animation: bgmPulse 2.5s infinite;
}
@keyframes bgmPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 143, 163, 0.5); }
    50% { box-shadow: 0 0 0 10px rgba(255, 143, 163, 0); }
}

/* 볼륨 슬라이더 — 평소엔 숨김, 호버/확장 시 펼침 */
.bgm-volume {
    -webkit-appearance: none;
    appearance: none;
    width: 0;
    height: 4px;
    background: rgba(255, 143, 163, 0.25);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    opacity: 0;
    transition: width 0.25s, opacity 0.25s, margin 0.25s;
    margin: 0;
}
.bgm-control:hover .bgm-volume,
.bgm-control.expanded .bgm-volume {
    width: 100px;
    opacity: 1;
    margin-right: 4px;
}
.bgm-volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-strawberry);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
.bgm-volume::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-strawberry);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

@media (max-width: 600px) {
    .bgm-control {
        top: 10px;
        right: 10px;
    }
    .bgm-toggle {
        width: 34px;
        height: 34px;
        font-size: 1rem;
    }
    /* 모바일은 슬라이더 항상 좁게 표시 */
    .bgm-volume,
    .bgm-control:hover .bgm-volume,
    .bgm-control.expanded .bgm-volume {
        width: 60px;
        opacity: 1;
        margin-right: 4px;
    }
}

/* 플로팅 캐릭터챗 버튼 (모든 페이지 우하단 고정) */
.play-floating {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 90;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--accent-strawberry), var(--accent-caramel));
    color: white;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    box-shadow: 0 6px 20px rgba(255, 143, 163, 0.5);
    transition: all 0.25s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.play-floating:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(255, 143, 163, 0.6);
    color: white;
}
.play-floating::before {
    content: '▶';
    font-size: 0.85rem;
}
@media (max-width: 600px) {
    .play-floating {
        bottom: 16px;
        right: 16px;
        padding: 10px 16px;
        font-size: 0.85rem;
    }
}

/* ---------- 태그·칩 ---------- */
.chip {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--bg-soft);
    color: var(--text-soft);
    font-size: 0.85rem;
    margin: 2px;
}

.chip.accent-strawberry { background: var(--accent-strawberry); color: white; }
.chip.accent-caramel { background: var(--accent-caramel); color: white; }
.chip.accent-matcha { background: var(--accent-matcha); color: white; }
.chip.accent-blueberry { background: var(--accent-blueberry); color: white; }

/* ---------- 유틸 ---------- */
.text-center { text-align: center; }
.text-soft { color: var(--text-soft); }
.text-mute { color: var(--text-mute); }
.mt-md { margin-top: var(--gap-md); }
.mt-lg { margin-top: var(--gap-lg); }
.mb-md { margin-bottom: var(--gap-md); }
.mb-lg { margin-bottom: var(--gap-lg); }
