/* =========================================================
   mill Archive - Stylesheet (우주 테마 강화 버전)
   컨셉: 우주(Space) + 밀크티 + 둥근 손글씨 감성
   ========================================================= */

/* ----- 1. 컬러/폰트 변수 ----- */
:root {
    --bg-deep: #050614;          /* 더 깊은 우주 */
    --bg-mid: #0e1130;
    --bg-card: rgba(20, 22, 50, 0.55);   /* 반투명 카드 (배경 비침) */
    --accent: #f5f5dc;           /* 밀크티 베이지 */
    --accent-soft: #e8e8c8;
    --accent-cool: #a9c2ff;      /* 우주 블루 */
    --accent-purple: #c9a5ff;    /* 성운 퍼플 */
    --accent-pink: #ff9ecd;      /* 핑크 별 */
    --text: #f4f1ea;
    --text-dim: #9ea0c0;
    --border: rgba(255, 255, 255, 0.1);

    --font-main: 'Gowun Dodum', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
    --font-display: 'Jua', 'Gowun Dodum', sans-serif;
    --font-mono: 'Space Mono', monospace;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 110px; }

body {
    background: var(--bg-deep);
    color: var(--text);
    font-family: var(--font-main);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ----- 2. 우주 배경 컨테이너 ----- */
.cosmos {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

/* ----- 3. 성운 (Nebula) ----- */
.nebula {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.55;
    mix-blend-mode: screen;
    animation: nebulaDrift 30s ease-in-out infinite alternate;
}

.nebula-1 {
    width: 700px; height: 700px;
    top: -150px; left: -100px;
    background: radial-gradient(circle, #5b2a8c 0%, #2a1655 40%, transparent 70%);
}

.nebula-2 {
    width: 600px; height: 600px;
    top: 30%; right: -150px;
    background: radial-gradient(circle, #1f4d8c 0%, #0d2152 40%, transparent 70%);
    animation-delay: -10s;
    animation-duration: 40s;
}

.nebula-3 {
    width: 500px; height: 500px;
    bottom: -100px; left: 30%;
    background: radial-gradient(circle, #8c2a5a 0%, #4d1233 40%, transparent 70%);
    animation-delay: -20s;
    animation-duration: 50s;
}

@keyframes nebulaDrift {
    0%   { transform: translate(0, 0)         scale(1);   }
    50%  { transform: translate(40px, -30px)  scale(1.1); }
    100% { transform: translate(-30px, 40px)  scale(0.95); }
}

/* ----- 4. 별 레이어 (3겹 패럴랙스) ----- */
.stars {
    position: absolute;
    inset: 0;
    background-repeat: repeat;
}

.stars-far {
    background-image:
        radial-gradient(0.6px 0.6px at 13% 17%, white, transparent),
        radial-gradient(0.6px 0.6px at 47% 64%, white, transparent),
        radial-gradient(0.6px 0.6px at 82% 33%, white, transparent),
        radial-gradient(0.6px 0.6px at 25% 88%, white, transparent),
        radial-gradient(0.6px 0.6px at 71% 11%, white, transparent),
        radial-gradient(0.6px 0.6px at 5% 52%, white, transparent),
        radial-gradient(0.6px 0.6px at 91% 79%, white, transparent),
        radial-gradient(0.6px 0.6px at 38% 41%, white, transparent),
        radial-gradient(0.6px 0.6px at 60% 94%, white, transparent);
    background-size: 600px 600px;
    opacity: 0.6;
    animation: drift 200s linear infinite;
}

.stars-mid {
    background-image:
        radial-gradient(1px 1px at 22% 35%, white, transparent),
        radial-gradient(1px 1px at 68% 75%, white, transparent),
        radial-gradient(1px 1px at 84% 14%, var(--accent-cool), transparent),
        radial-gradient(1px 1px at 33% 82%, white, transparent),
        radial-gradient(1px 1px at 92% 48%, white, transparent),
        radial-gradient(1px 1px at 12% 62%, var(--accent-purple), transparent),
        radial-gradient(1px 1px at 53% 22%, white, transparent),
        radial-gradient(1px 1px at 76% 56%, white, transparent);
    background-size: 800px 800px;
    opacity: 0.85;
    animation: drift 130s linear infinite;
}

.stars-near {
    background-image:
        radial-gradient(1.6px 1.6px at 18% 28%, white, transparent),
        radial-gradient(1.6px 1.6px at 78% 12%, var(--accent), transparent),
        radial-gradient(1.6px 1.6px at 41% 71%, var(--accent-pink), transparent),
        radial-gradient(1.6px 1.6px at 88% 64%, white, transparent),
        radial-gradient(1.6px 1.6px at 8% 90%, white, transparent),
        radial-gradient(1.6px 1.6px at 62% 38%, var(--accent-cool), transparent);
    background-size: 1000px 1000px;
    opacity: 1;
    animation: drift 80s linear infinite;
}

@keyframes drift {
    from { background-position: 0 0; }
    to   { background-position: 1000px 1000px; }
}

/* ----- 5. 반짝이는 큰 별 ----- */
.twinkle {
    position: absolute;
    width: 3px; height: 3px;
    background: white;
    border-radius: 50%;
    box-shadow:
        0 0 4px white,
        0 0 8px white,
        0 0 16px var(--accent-cool);
    animation: twinkle 3s ease-in-out infinite;
}

.twinkle::before, .twinkle::after {
    content: '';
    position: absolute;
    background: linear-gradient(transparent, white, transparent);
}
.twinkle::before {
    width: 1px; height: 30px;
    left: 50%; top: -15px;
    transform: translateX(-50%);
}
.twinkle::after {
    width: 30px; height: 1px;
    top: 50%; left: -15px;
    transform: translateY(-50%);
    background: linear-gradient(90deg, transparent, white, transparent);
}

.twinkle-1 { top: 14%; left: 18%; animation-delay: 0s;    }
.twinkle-2 { top: 28%; right: 22%; animation-delay: 1s;
             box-shadow: 0 0 4px white, 0 0 10px var(--accent-pink), 0 0 20px var(--accent-pink); }
.twinkle-3 { top: 60%; left: 12%; animation-delay: 2s;
             box-shadow: 0 0 4px white, 0 0 10px var(--accent-purple), 0 0 20px var(--accent-purple); }
.twinkle-4 { top: 75%; right: 15%; animation-delay: 1.5s; }

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

/* ----- 6. 떠다니는 행성 ----- */
.planet {
    position: absolute;
    top: 12%;
    right: 8%;
    width: 140px; height: 140px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 30% 30%, #f5e0c8 0%, #d4a574 35%, #8b5a3c 70%, #3d2515 100%);
    box-shadow:
        inset -20px -20px 40px rgba(0, 0, 0, 0.5),
        inset 20px 20px 30px rgba(255, 220, 180, 0.15),
        0 0 60px rgba(212, 165, 116, 0.3),
        0 0 120px rgba(212, 165, 116, 0.15);
    opacity: 0.85;
    animation: planetFloat 20s ease-in-out infinite;
}

/* 행성 고리 */
.planet::after {
    content: '';
    position: absolute;
    inset: -25px -45px;
    border-radius: 50%;
    border: 2px solid rgba(245, 245, 220, 0.25);
    border-top-color: rgba(245, 245, 220, 0.5);
    transform: rotate(-25deg);
    box-shadow: 0 0 20px rgba(245, 245, 220, 0.1);
}

@keyframes planetFloat {
    0%, 100% { transform: translateY(0)    rotate(0deg);   }
    50%      { transform: translateY(-15px) rotate(8deg);  }
}

/* ----- 7. 유성 (Shooting Star) ----- */
.shooting-star {
    position: absolute;
    width: 2px; height: 2px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 6px 1px white;
    opacity: 0;
}

.shooting-star::before {
    content: '';
    position: absolute;
    top: 50%;
    right: 0;
    width: 120px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), white);
    transform: translateY(-50%);
}

.shooting-star-1 {
    top: 18%; left: 100%;
    animation: shoot1 8s ease-in infinite;
    animation-delay: 2s;
}

.shooting-star-2 {
    top: 55%; left: 100%;
    animation: shoot1 11s ease-in infinite;
    animation-delay: 6s;
}

@keyframes shoot1 {
    0%   { transform: translate(0, 0)            rotate(20deg); opacity: 0; }
    5%   { opacity: 1; }
    50%  { transform: translate(-110vw, 50vh)    rotate(20deg); opacity: 1; }
    60%  { opacity: 0; }
    100% { transform: translate(-110vw, 50vh)    rotate(20deg); opacity: 0; }
}

/* ----- 8. 헤더 ----- */
.header {
    position: relative;
    z-index: 2;
    padding: 80px 24px 40px;
    text-align: center;
}

.header-inner { max-width: 1200px; margin: 0 auto; }

.logo {
    font-family: var(--font-display);
    font-size: clamp(36px, 5.5vw, 60px);
    font-weight: 400;
    display: inline-flex;
    align-items: center;
    gap: 14px;
    letter-spacing: -0.5px;
    text-shadow:
        0 0 20px rgba(245, 245, 220, 0.3),
        0 0 40px rgba(169, 194, 255, 0.2);
}

.logo-icon, .logo-cup {
    display: inline-block;
    animation: float 4s ease-in-out infinite;
    filter: drop-shadow(0 0 12px rgba(169, 194, 255, 0.5));
}
.logo-icon { font-size: 0.9em; }
.logo-cup  { font-size: 0.7em; animation-delay: -2s; }

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-10px); }
}

.logo-text em {
    color: var(--accent);
    font-style: normal;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-cool) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ----- 8-1. 공식 채널 링크 ----- */
.channel-link {
    margin-top: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1.5px solid var(--border);
    background: rgba(5, 6, 20, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--text-dim);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.2px;
    transition: all 0.25s ease;
}

.channel-link:hover {
    color: var(--accent);
    border-color: rgba(255, 77, 77, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 0 24px rgba(255, 77, 77, 0.25);
}

.channel-link .yt-icon {
    width: 18px;
    height: 18px;
    fill: #ff4d4d;
    filter: drop-shadow(0 0 6px rgba(255, 77, 77, 0.55));
    transition: transform 0.25s ease;
}

.channel-link:hover .yt-icon { transform: scale(1.1); }

/* ----- 8-2. 상단 요약 바 ----- */
.summary-bar {
    position: relative;
    z-index: 2;
    max-width: 1200px;
    margin: 0 auto;
    padding: 6px 24px 24px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 12px;
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--text-dim);
}

.summary-bar .stat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.summary-bar .stat strong {
    color: var(--accent);
    font-weight: 700;
    font-size: 17px;
    text-shadow: 0 0 12px rgba(245, 245, 220, 0.35);
}

.summary-bar .stat-unit {
    margin-left: 2px;
    font-size: 13px;
}

.summary-bar .stat-sep {
    color: var(--border);
    font-size: 14px;
}

.summary-bar .stat-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.summary-bar .dot-cover {
    background: rgba(245, 245, 220, 0.75);
    border: 1px solid rgba(245, 245, 220, 0.9);
}

.summary-bar .dot-featuring {
    background: rgba(169, 194, 255, 0.9);
    box-shadow: 0 0 10px rgba(169, 194, 255, 0.7);
}

.summary-bar .dot-pandora {
    background: rgba(201, 165, 255, 0.95);
    box-shadow: 0 0 10px rgba(201, 165, 255, 0.75);
}

.summary-bar .stat-range {
    padding: 2px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(20, 22, 50, 0.4);
    color: var(--accent-soft);
}

/* ----- 9. 연도 바로가기 (sticky) ----- */
.year-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 14px 16px;
    background: rgba(5, 6, 20, 0.65);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.year-nav a {
    color: var(--text-dim);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 14px;
    padding: 8px 18px;
    border-radius: 999px;
    border: 1.5px solid transparent;
    transition: all 0.25s ease;
}

.year-nav a:hover {
    color: var(--accent);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(245, 245, 220, 0.25);
}

.year-nav a.active {
    color: var(--bg-deep);
    background: var(--accent);
    border-color: var(--accent);
    font-weight: 700;
    box-shadow: 0 0 24px rgba(245, 245, 220, 0.5);
}

/* ----- 9-1. 뷰 + 정렬 스위치 공통 레이아웃 ----- */
.view-bar {
    position: relative;
    z-index: 2;
    max-width: 1200px;
    margin: 0 auto;
    padding: 22px 24px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.view-switch,
.sort-switch {
    display: flex;
    gap: 6px;
}

.view-switch button,
.sort-switch button {
    appearance: none;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 12.5px;
    letter-spacing: 0.3px;
    padding: 7px 14px;
    border-radius: 999px;
    border: 1.5px solid var(--border);
    background: rgba(5, 6, 20, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--text-dim);
    transition: all 0.25s ease;
}

.view-switch button:hover,
.sort-switch button:hover {
    color: var(--accent);
    border-color: var(--accent);
    transform: translateY(-1px);
}

.view-switch button.active,
.sort-switch button.active {
    color: var(--bg-deep);
    background: var(--accent);
    border-color: var(--accent);
    font-weight: 700;
    box-shadow: 0 0 20px rgba(245, 245, 220, 0.45);
}

/* ----- 9-2. 별자리 뷰에서는 그리드용 UI 숨김 ----- */
body[data-view="constellation"] .year-nav,
body[data-view="constellation"] .sort-switch {
    display: none;
}

body[data-view="grid"]          #constellation { display: none; }
body[data-view="constellation"] #archive       { display: none; }

/* ----- 10. 메인 컨테이너 / 연도 섹션 ----- */
.container {
    position: relative;
    z-index: 2;
    max-width: 1200px;
    margin: 0 auto;
    padding: 50px 24px 80px;
}

.year-section {
    margin-bottom: 80px;
    scroll-margin-top: 110px;
}

.year-section:last-child { margin-bottom: 0; }

.year-heading {
    display: flex;
    align-items: baseline;
    gap: 14px;
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    position: relative;
}

/* 연도 헤딩에 글로우 라인 */
.year-heading::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100px;
    height: 1px;
    background: linear-gradient(90deg, var(--accent), transparent);
    box-shadow: 0 0 12px var(--accent);
}

.year-heading h2 {
    font-family: var(--font-display);
    font-size: clamp(40px, 6.5vw, 64px);
    color: var(--accent);
    letter-spacing: -1px;
    text-shadow:
        0 0 24px rgba(245, 245, 220, 0.35),
        0 0 48px rgba(169, 194, 255, 0.2);
}

.year-heading .count {
    font-family: var(--font-mono);
    color: var(--text-dim);
    font-size: 14px;
}

/* ----- 11. 카드 그리드 ----- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 22px;
}

.card {
    display: block;
    color: inherit;
    text-decoration: none;
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow: hidden;
    cursor: pointer;
    transition:
        transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 0.3s ease,
        border-color 0.3s ease;
    position: relative;
    opacity: 0;
    transform: translateY(20px);
}

/* 카드 외곽 글로우 */
.card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 18px;
    padding: 1px;
    background: linear-gradient(135deg,
        rgba(245, 245, 220, 0) 0%,
        rgba(169, 194, 255, 0.15) 50%,
        rgba(201, 165, 255, 0.15) 100%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card.appear {
    opacity: 1;
    transform: translateY(0);
}

.card:hover {
    transform: translateY(-8px);
    border-color: var(--accent);
    box-shadow:
        0 24px 50px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(245, 245, 220, 0.2),
        0 0 40px rgba(169, 194, 255, 0.25);
}

.card:hover::before { opacity: 1; }

.thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #000;
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease, filter 0.5s ease;
    filter: brightness(0.92);
}

.card:hover .thumb img { transform: scale(1.06); filter: brightness(1); }

.play-icon {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(245, 245, 220, 0.95);
    color: var(--bg-deep);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    padding-left: 4px;
    opacity: 0;
    transform: scale(0.6);
    transition: all 0.3s ease;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4),
                0 0 30px rgba(245, 245, 220, 0.4);
}

.card:hover .play-icon {
    opacity: 1;
    transform: scale(1);
}

/* COVER / FEAT. 배지 */
.badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 10px;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    border-radius: 999px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2;
}

.badge-cover {
    background: rgba(5, 6, 20, 0.65);
    color: var(--accent-soft);
    border: 1px solid rgba(245, 245, 220, 0.35);
}

.badge-featuring {
    background: rgba(169, 194, 255, 0.9);
    color: var(--bg-deep);
    border: 1px solid rgba(169, 194, 255, 1);
    box-shadow: 0 2px 16px rgba(169, 194, 255, 0.55);
}

/* 판도라 배지 — 미공개/내린 곡 컴필레이션. 어둡고 신비로운 보라 톤 */
.badge-pandora {
    background: linear-gradient(135deg, rgba(91, 42, 140, 0.92), rgba(20, 22, 50, 0.95));
    color: #e8d8ff;
    border: 1px solid rgba(201, 165, 255, 0.7);
    box-shadow:
        0 2px 16px rgba(201, 165, 255, 0.4),
        inset 0 0 8px rgba(201, 165, 255, 0.15);
    letter-spacing: 0.8px;
}

.card-body { padding: 14px 16px 18px; }

.card-body h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    min-height: 2.8em;
}

.card-body .date {
    font-size: 13px;
    color: var(--text-dim);
    font-family: var(--font-mono);
}

/* ----- 11-1. 별자리 뷰 ----- */
.constellation {
    position: relative;
    width: 100%;
    height: 70vh;
    min-height: 520px;
    margin-top: 20px;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    overflow: visible;
}

.const-canvas {
    position: absolute;
    inset: 0 0 42px 0; /* 아래 42px은 연도 축 영역 */
    z-index: 2;
}

/* ----- 11-1b. 배경 별들 (장식용) ----- */
.const-starfield {
    position: absolute;
    inset: 0 0 42px 0;
    pointer-events: none;
    z-index: 1;
}

/* ----- 11-1c. 별자리 선 (SVG 오버레이) -----
   같은 원곡자/콜라보 별을 잇는 가는 라인. 별보다 한 단계 뒤에 깔림.
   기본은 옅게 → :has 호버 시 해당 그룹만 또렷해짐. */
.const-lines {
    display: none;
}

.const-legend,
.const-hint {
    display: none;
}

.const-line {
    stroke: currentColor;       /* color: 인라인 style에서 지정됨 → drop-shadow와 currentColor 둘 다 활용 */
    fill: none;
    stroke-dasharray: var(--line-len) var(--line-len);
    stroke-dashoffset: var(--line-len);
    opacity: 0;
    animation: lineDraw 1.8s cubic-bezier(0.65, 0, 0.35, 1) forwards;
    animation-delay: var(--line-delay, 0s);
    transition: stroke-width 0.35s ease, filter 0.35s ease;
}

@keyframes lineDraw {
    0%   { opacity: 0;    stroke-dashoffset: var(--line-len); }
    25%  { opacity: 0.7;                                       }
    100% { opacity: 0.55; stroke-dashoffset: 0;                }
}

/* 호버 시: 같은 그룹의 라인을 강조. :has()로 위쪽 컨테이너에서 캡쳐 */
.constellation:has(.star[data-groups~="deco27"]:hover) .const-line[data-group="deco27"],
.constellation:has(.star[data-groups~="giga"]:hover)   .const-line[data-group="giga"],
.constellation:has(.star[data-groups~="seibin"]:hover) .const-line[data-group="seibin"],
.constellation:has(.star[data-groups~="haita"]:hover)  .const-line[data-group="haita"],
.constellation:has(.const-legend-item[data-group="deco27"]:hover) .const-line[data-group="deco27"],
.constellation:has(.const-legend-item[data-group="giga"]:hover)   .const-line[data-group="giga"],
.constellation:has(.const-legend-item[data-group="seibin"]:hover) .const-line[data-group="seibin"],
.constellation:has(.const-legend-item[data-group="haita"]:hover)  .const-line[data-group="haita"] {
    stroke-width: 1.6;
    filter: brightness(1.7) drop-shadow(0 0 4px currentColor);
}

/* ----- 11-1d. 별자리 범례 ----- */
.const-legend {
    position: absolute;
    top: 14px;
    right: 16px;
    z-index: 4;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(5, 6, 20, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
    letter-spacing: 0.3px;
    pointer-events: auto;
    transition: opacity 0.3s ease;
    opacity: 0.85;
}

.const-legend:hover { opacity: 1; }

.const-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: default;
    transition: color 0.2s ease;
}

.const-legend-item:hover { color: var(--accent); }

.const-legend-line {
    display: inline-block;
    width: 20px;
    height: 2px;
    border-radius: 1px;
    box-shadow: 0 0 4px currentColor;
}

.bg-star {
    position: absolute;
    border-radius: 50%;
    box-shadow: 0 0 2px currentColor;
    opacity: var(--base-opacity, 0.5);
    animation: bgStarTwinkle var(--tw-dur, 3s) ease-in-out infinite;
    animation-delay: var(--tw-delay, 0s);
}

@keyframes bgStarTwinkle {
    0%, 100% { opacity: calc(var(--base-opacity, 0.5) * 0.35); transform: scale(0.8); }
    50%      { opacity: var(--base-opacity, 0.5);              transform: scale(1.15); }
}

/* ----- 11-2. 별 -----
   레이어 구조 (안 → 밖):
     .star-core    — 솔리드 흰 코어 + 가로/세로 메인 4-spike (길고 hot)
     .star-spikes  — 대각선 4-spike (메인보다 짧고 옅음 → 8-spike sparkle)
     .star-bloom   — 별 바깥의 부드러운 halo
     .star-flare   — 호버/포커스 시에만 보이는 동심원 렌즈 플레어
   → 빛 sparkle PNG의 시각을 순수 CSS로 재현
*/
.star {
    position: absolute;
    transform: translate(-50%, -50%);
    text-decoration: none;
    color: inherit;
    outline: none;
    --star-size: 8px;
    --star-glow-inner: 10px;
    --star-glow-outer: 22px;
}

.star-sm {
    --star-size: 11px;
    --star-glow-inner: 14px;
    --star-glow-outer: 32px;
}

.star-lg {
    --star-size: 18px;
    --star-glow-inner: 22px;
    --star-glow-outer: 54px;
}

/* ---- 별 본체: PNG sparkle처럼 중앙은 단단한 흰빛, 가장자리는 색조로 빠르게 페이드 ---- */
.star-core {
    display: block;
    width: var(--star-size);
    height: var(--star-size);
    border-radius: 50%;
    /* 중앙 정렬된 hot white solid → 좁은 색조 띠 → 부드러운 페이드. PNG 코어처럼 또렷한 흰 점 */
    background:
        radial-gradient(circle at 50% 50%,
            #ffffff 0%,
            #ffffff 28%,
            color-mix(in srgb, var(--star-color, white) 45%, #ffffff) 50%,
            var(--star-color, white) 78%,
            color-mix(in srgb, var(--star-color, white) 60%, transparent) 95%,
            transparent 100%);
    /* 색수차: 따뜻한 톤(빨강쪽)을 미세 우상단으로, 차가운 톤(파랑쪽)을 미세 좌하단으로 살짝 어긋나게 → 렌즈로 본 별 */
    box-shadow:
        0.5px -0.5px 4px rgba(255, 200, 180, 0.55),
        -0.5px 0.5px 4px rgba(180, 200, 255, 0.55),
        0 0 var(--star-glow-inner) var(--star-color, white),
        0 0 var(--star-glow-outer) var(--star-color, white);
    animation: starTwinkle 3.2s ease-in-out infinite;
    animation-delay: var(--twinkle-delay, 0s);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
    position: relative;
    z-index: 2;
}

/* ---- 메인 4갈래 광선: 가로/세로. PNG처럼 길고, 중앙은 두꺼운 hot white, 양끝은 가늘게 페이드 ---- */
.star-core::before,
.star-core::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    opacity: 0.95;
    pointer-events: none;
    /* 광선 글로우: 별 색으로 색번짐 */
    filter: drop-shadow(0 0 2px var(--star-color, white));
}

.star-core::before {
    width: calc(var(--star-size) * 7);
    height: 1.2px;
    transform: translate(-50%, -50%);
    background: linear-gradient(to right,
        transparent 0%,
        color-mix(in srgb, var(--star-color, white) 35%, transparent) 18%,
        color-mix(in srgb, var(--star-color, white) 80%, #ffffff) 38%,
        #ffffff 50%,
        color-mix(in srgb, var(--star-color, white) 80%, #ffffff) 62%,
        color-mix(in srgb, var(--star-color, white) 35%, transparent) 82%,
        transparent 100%);
}

.star-core::after {
    width: 1.2px;
    height: calc(var(--star-size) * 7);
    transform: translate(-50%, -50%);
    background: linear-gradient(to bottom,
        transparent 0%,
        color-mix(in srgb, var(--star-color, white) 35%, transparent) 18%,
        color-mix(in srgb, var(--star-color, white) 80%, #ffffff) 38%,
        #ffffff 50%,
        color-mix(in srgb, var(--star-color, white) 80%, #ffffff) 62%,
        color-mix(in srgb, var(--star-color, white) 35%, transparent) 82%,
        transparent 100%);
}

/* ---- 대각선 4갈래 부광선: 메인 광선의 약 60% 길이, 중앙도 흰빛 hot zone 보유. 8-spike sparkle ---- */
.star-spikes {
    position: absolute;
    left: 50%;
    top: 50%;
    width: calc(var(--star-size) * 4.2);
    height: calc(var(--star-size) * 4.2);
    transform: translate(-50%, -50%) rotate(45deg);
    pointer-events: none;
    opacity: 0.7;
    animation: starTwinkle 3.2s ease-in-out infinite;
    animation-delay: var(--twinkle-delay, 0s);
    z-index: 2;
    filter: drop-shadow(0 0 1.5px var(--star-color, white));
}

.star-spikes::before,
.star-spikes::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
}

.star-spikes::before {
    width: 100%;
    height: 1px;
    transform: translate(-50%, -50%);
    background: linear-gradient(to right,
        transparent 0%,
        color-mix(in srgb, var(--star-color, white) 50%, transparent) 25%,
        #ffffff 50%,
        color-mix(in srgb, var(--star-color, white) 50%, transparent) 75%,
        transparent 100%);
}

.star-spikes::after {
    width: 1px;
    height: 100%;
    transform: translate(-50%, -50%);
    background: linear-gradient(to bottom,
        transparent 0%,
        color-mix(in srgb, var(--star-color, white) 50%, transparent) 25%,
        #ffffff 50%,
        color-mix(in srgb, var(--star-color, white) 50%, transparent) 75%,
        transparent 100%);
}

/* ---- 외부 블룸: 별 한참 바깥까지 퍼지는 저주파 광원. 사진 합성의 lens bloom 같은 느낌 ---- */
.star-bloom {
    position: absolute;
    left: 50%;
    top: 50%;
    width: calc(var(--star-size) * 9);
    height: calc(var(--star-size) * 9);
    transform: translate(-50%, -50%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
    background: radial-gradient(circle,
        color-mix(in srgb, var(--star-color, white) 35%, transparent) 0%,
        color-mix(in srgb, var(--star-color, white) 18%, transparent) 22%,
        color-mix(in srgb, var(--star-color, white) 8%, transparent) 45%,
        transparent 70%);
    filter: blur(2px);
    animation: bloomPulse 5.4s ease-in-out infinite;
    animation-delay: var(--twinkle-delay, 0s);
}

/* ---- 호버 시 렌즈 플레어: 가는 동심원 ring + 살짝 큰 광선 확장 ---- */
.star-flare {
    position: absolute;
    left: 50%;
    top: 50%;
    width: calc(var(--star-size) * 5);
    height: calc(var(--star-size) * 5);
    transform: translate(-50%, -50%) scale(0.55);
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
    z-index: 3;
    background:
        /* 안쪽 가는 ring */
        radial-gradient(circle,
            transparent 32%,
            color-mix(in srgb, var(--star-color, white) 65%, transparent) 36%,
            color-mix(in srgb, var(--star-color, white) 30%, transparent) 39%,
            transparent 44%),
        /* 바깥 부드러운 halo */
        radial-gradient(circle,
            transparent 55%,
            color-mix(in srgb, var(--star-color, white) 25%, transparent) 65%,
            transparent 78%);
    transition:
        opacity 0.4s ease,
        transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes starTwinkle {
    0%, 100% { opacity: 0.55; transform: scale(0.9); }
    50%      { opacity: 1;    transform: scale(1.15); }
}

@keyframes bloomPulse {
    0%, 100% { opacity: 0.45; transform: translate(-50%, -50%) scale(0.95); }
    50%      { opacity: 0.85; transform: translate(-50%, -50%) scale(1.1); }
}

/* 판도라 별 — 사라졌다 잠깐 나타나는 듯한 강한 점멸.
   일반 별보다 더 길고 불규칙한 사이클로 '잃어버린 별' 분위기.
   모든 레이어가 같은 박자로 깜빡여야 한 별로 읽힘. */
.star-pandora .star-core,
.star-pandora .star-spikes {
    animation: pandoraFlicker 5s ease-in-out infinite;
}

.star-pandora .star-bloom {
    animation: pandoraBloomFlicker 5s ease-in-out infinite;
}

@keyframes pandoraBloomFlicker {
    0%, 100% { opacity: 0.08; transform: translate(-50%, -50%) scale(0.88); }
    18%      { opacity: 0.04; transform: translate(-50%, -50%) scale(0.85); }
    32%      { opacity: 0.7;  transform: translate(-50%, -50%) scale(1.18); }
    44%      { opacity: 0.15; transform: translate(-50%, -50%) scale(0.95); }
    58%      { opacity: 0.65; transform: translate(-50%, -50%) scale(1.12); }
    72%      { opacity: 0.06; transform: translate(-50%, -50%) scale(0.9);  }
    86%      { opacity: 0.35; transform: translate(-50%, -50%) scale(1.0);  }
}

@keyframes pandoraFlicker {
    0%, 100% { opacity: 0.15; transform: scale(0.8); }
    18%      { opacity: 0.08; transform: scale(0.78); }
    32%      { opacity: 1;    transform: scale(1.3);  }
    44%      { opacity: 0.25; transform: scale(0.9);  }
    58%      { opacity: 0.95; transform: scale(1.22); }
    72%      { opacity: 0.12; transform: scale(0.82); }
    86%      { opacity: 0.55; transform: scale(1.05); }
}

.star:hover .star-core,
.star:focus-visible .star-core {
    transform: scale(1.7);
    box-shadow:
        0.5px -0.5px 6px rgba(255, 200, 180, 0.7),
        -0.5px 0.5px 6px rgba(180, 200, 255, 0.7),
        0 0 calc(var(--star-glow-inner) * 1.4) var(--star-color, white),
        0 0 calc(var(--star-glow-outer) * 1.6) var(--star-color, white);
    animation-play-state: paused;
}

.star:hover .star-spikes,
.star:focus-visible .star-spikes {
    opacity: 0.95;
    transform: translate(-50%, -50%) rotate(45deg) scale(1.4);
    transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.star:hover .star-bloom,
.star:focus-visible .star-bloom {
    animation-play-state: paused;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.25);
    transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.star:hover .star-flare,
.star:focus-visible .star-flare {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.star:focus-visible {
    outline: 2px solid rgba(245, 245, 220, 0.7);
    outline-offset: 12px;
    border-radius: 50%;
}

/* ----- 11-3. 별 팝업 ----- */
.star-popup {
    position: absolute;
    width: 200px;
    background: rgba(10, 12, 30, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(245, 245, 220, 0.25);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 3;
}

/* 세로 방향 — 위쪽 별은 아래로 펼쳐서 캔버스에 잘리지 않게 */
.star-popup.pop-above { bottom: calc(100% + 14px); }
.star-popup.pop-below { top:    calc(100% + 14px); }

/* 가로 방향 */
.star-popup.pop-right  { left: 0; }
.star-popup.pop-left   { right: 0; }
.star-popup.pop-center { left: 50%; }

/* 초기(숨김) 상태의 transform — 팝업이 뜨는 방향 쪽에서 살짝 슬라이드 인 */
.star-popup.pop-above                 { transform: translateY(6px); }
.star-popup.pop-below                 { transform: translateY(-6px); }
.star-popup.pop-center.pop-above      { transform: translate(-50%, 6px); }
.star-popup.pop-center.pop-below      { transform: translate(-50%, -6px); }

.star:hover .star-popup,
.star:focus-visible .star-popup {
    opacity: 1;
    pointer-events: auto;
}

/* 표시 상태의 transform — 제자리 */
.star:hover .star-popup.pop-above,
.star:focus-visible .star-popup.pop-above,
.star:hover .star-popup.pop-below,
.star:focus-visible .star-popup.pop-below            { transform: translateY(0); }

.star:hover .star-popup.pop-center.pop-above,
.star:focus-visible .star-popup.pop-center.pop-above,
.star:hover .star-popup.pop-center.pop-below,
.star:focus-visible .star-popup.pop-center.pop-below { transform: translate(-50%, 0); }

.star-popup-thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #000;
}

.star-popup-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.star-popup-body {
    padding: 10px 12px 12px;
}

.star-popup-body h4 {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--text);
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.star-popup-body p {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
}

/* ----- 11-4. 연도 축 + 힌트 ----- */
.const-axis {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 42px;
}

.const-year {
    position: absolute;
    top: 10px;
    transform: translateX(-50%);
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-dim);
    letter-spacing: 1px;
}

.const-hint {
    position: absolute;
    bottom: 50px;       /* 연도 축(42px) 바로 위 */
    left: 16px;
    right: 16px;
    text-align: left;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
    opacity: 0.55;
    pointer-events: none;
    letter-spacing: 0.4px;
}

/* ----- 12. 푸터 ----- */
.footer {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 40px 24px 60px;
    color: var(--text-dim);
    font-size: 13px;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

.footer .small { font-size: 11px; margin-top: 4px; opacity: 0.6; }

/* ----- 13. 반응형 ----- */
@media (max-width: 768px) {
    .planet {
        width: 90px; height: 90px;
        top: 8%; right: 5%;
    }
    .planet::after { inset: -16px -30px; }
}

@media (max-width: 640px) {
    .header { padding: 60px 16px 24px; }
    .container { padding: 30px 16px 60px; }

    .grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 14px;
    }

    .card-body { padding: 12px 14px 16px; }
    .card-body h3 { font-size: 14px; min-height: 2.8em; }
    .card-body .date { font-size: 12px; }

    .year-nav { padding: 10px 12px; gap: 6px; }
    .year-nav a { padding: 6px 14px; font-size: 13px; }

    .summary-bar {
        padding: 4px 16px 18px;
        font-size: 13px;
        gap: 8px;
    }
    .summary-bar .stat strong { font-size: 15px; }

    .sort-switch {
        padding: 16px 16px 0;
        justify-content: center;
    }
    .sort-switch button { padding: 6px 12px; font-size: 12px; }

    .channel-link {
        margin-top: 12px;
        padding: 6px 14px;
        font-size: 12px;
    }
    .channel-link .yt-icon { width: 16px; height: 16px; }

    .view-bar {
        padding: 16px 16px 0;
        justify-content: center;
    }
    .view-switch button,
    .sort-switch button { padding: 6px 12px; font-size: 12px; }

    .constellation {
        height: 60vh;
        min-height: 420px;
        border-radius: 18px;
    }
    .star-popup { width: 170px; }
    .const-year { font-size: 11px; }

    /* 모바일에선 범례를 더 작게 + 상단 좌측으로 옮겨 hint와 겹치지 않게 */
    .const-legend {
        top: 10px;
        right: 10px;
        padding: 8px 10px;
        font-size: 10px;
        gap: 4px;
        opacity: 0.75;
    }
    .const-legend-line { width: 14px; }
    .const-hint { font-size: 10px; bottom: 48px; }

    .nebula { filter: blur(60px); }
    .nebula-1 { width: 400px; height: 400px; }
    .nebula-2 { width: 360px; height: 360px; }
    .nebula-3 { width: 320px; height: 320px; }

    .twinkle-1, .twinkle-2 { display: none; }
}

@media (max-width: 380px) {
    .grid { grid-template-columns: 1fr; }
}

/* 모션 줄이기 옵션 사용자 배려 */
@media (prefers-reduced-motion: reduce) {
    .nebula, .stars, .twinkle, .planet, .shooting-star, .logo-icon, .logo-cup,
    .star-core, .star-spikes, .star-bloom, .bg-star {
        animation: none !important;
    }
    /* 별자리 선은 들어올 때 그려지는 애니메이션을 끄고 바로 보이게 */
    .const-line {
        animation: none !important;
        opacity: 0.55 !important;
        stroke-dashoffset: 0 !important;
    }
}

/* ----- 14. 인라인 유튜브 플레이어 모달 ----- */
.player-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.player-modal[hidden] { display: none; }

.player-back {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    cursor: pointer;
}

.player-wrap {
    position: relative;
    width: min(720px, 100%);
    background: rgba(10, 12, 30, 0.97);
    border: 1px solid rgba(245, 245, 220, 0.22);
    border-radius: 18px;
    overflow: hidden;
    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.75),
        0 0 60px rgba(169, 194, 255, 0.18);
    animation: playerIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes playerIn {
    from { opacity: 0; transform: scale(0.93); }
    to   { opacity: 1; transform: scale(1); }
}

.player-embed {
    aspect-ratio: 16 / 9;
    background: #000;
}

.player-embed iframe {
    width: 100%;
    height: 100%;
    display: block;
}

/* 썸네일 파사드 (사용자 클릭 시 iframe으로 교체) */
.player-facade {
    appearance: none;
    border: 0;
    padding: 0;
    margin: 0;
    width: 100%;
    height: 100%;
    background: #000;
    position: relative;
    cursor: pointer;
    display: block;
    overflow: hidden;
}

.player-facade img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease, filter 0.3s ease;
    filter: brightness(0.85);
}

.player-facade:hover img,
.player-facade:focus-visible img {
    transform: scale(1.04);
    filter: brightness(1);
}

.player-facade-play {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(245, 245, 220, 0.95);
    color: var(--bg-deep);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    padding-left: 5px;
    box-shadow:
        0 8px 30px rgba(0, 0, 0, 0.55),
        0 0 36px rgba(245, 245, 220, 0.55);
    transition: transform 0.25s ease;
}

.player-facade:hover .player-facade-play,
.player-facade:focus-visible .player-facade-play {
    transform: scale(1.08);
}

.player-meta {
    padding: 12px 18px 16px;
}

.player-title {
    font-family: var(--font-display);
    font-size: 15px;
    color: var(--text);
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-date {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
}

.player-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(0, 0, 0, 0.55);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    transition: background 0.2s;
}

.player-close:hover { background: rgba(255, 255, 255, 0.12); }
