/* ======================================================
   [4레인 코인 상점 박자 게임] 테마 및 상점 디자인 스타일 (style.css)
   ====================================================== */

/* --- 1. 기본 색상 변수 및 브라우저 초기화 --- */
:root {
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.85);
    --text-light: #f8fafc;
    --text-muted: #94a3b8;

    /* 기본 테마 색상 (Neo Dark) */
    --color-left: #a855f7;        /* 1번 레인 (← 보라) */
    --color-up: #3b82f6;          /* 2번 레인 (↑ 파랑) */
    --color-down: #22c55e;        /* 3번 레인 (↓ 초록) */
    --color-right: #ec4899;       /* 4번 레인 (→ 분홍) */
    
    /* 판정 색상 */
    --perfect-color: #38bdf8;
    --good-color: #4ade80;
    --miss-color: #f87171;

    --font-primary: 'Noto Sans KR', 'Outfit', sans-serif;
}

/* ======================================================
   🎨 6가지 색상 테마 커스텀 클래스 (Dynamic Themes)
   ====================================================== */

/* 1. 기본 클래스 (Neo Dark - 무료) */
body.theme-default {
    --color-left: #a855f7;
    --color-up: #3b82f6;
    --color-down: #22c55e;
    --color-right: #ec4899;
}

/* 2. 사이버 펑크 (Cyber Neon - 500 코인) */
body.theme-cyber {
    --color-left: #ff007f;   /* 핫핑크 */
    --color-up: #ffe600;     /* 네온 옐로우 */
    --color-down: #00ff66;   /* 형광 라임 */
    --color-right: #00f0ff;  /* 네온 시안 */
}

/* 3. 선셋 파스텔 (Sunset Pastel - 1,000 코인) */
body.theme-sunset {
    --color-left: #ff6b6b;   /* 코랄 오렌지 */
    --color-up: #fca5a5;     /* 살구 파스텔 */
    --color-down: #c084fc;   /* 라벤더 파스텔 */
    --color-right: #38bdf8;  /* 스카이 블루 */
}

/* 4. 에메랄드 포레스트 (Forest - 1,800 코인) */
body.theme-forest {
    --color-left: #2dd4bf;   /* 민트 */
    --color-up: #10b981;     /* 에메랄드 */
    --color-down: #84cc16;   /* 세이지 라임 */
    --color-right: #047857;  /* 딥 포레스트 */
}

/* 5. 골든 로얄 (Golden Royal - 3,500 코인) */
body.theme-gold {
    --color-left: #fbbf24;   /* 럭셔리 골드 */
    --color-up: #f59e0b;     /* 앰버 */
    --color-down: #d97706;   /* 브론즈 */
    --color-right: #fef08a;  /* 샴페인 Gold */
}

/* 6. 무지개 레인보우 (Rainbow - 6,000 코인) */
body.theme-rainbow {
    --color-left: #ef4444;   /* 빨강 */
    --color-up: #eab308;     /* 노랑 */
    --color-down: #3b82f6;   /* 파랑 */
    --color-right: #a855f7;  /* 보라 */
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-light);
    font-family: var(--font-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

/* --- 2. 배경 분위기 원 --- */
.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.35;
    z-index: 0;
    pointer-events: none;
    transition: background 0.5s ease;
}
.orb-1 {
    width: 350px;
    height: 350px;
    background: var(--color-left);
    top: -50px;
    left: -50px;
}
.orb-2 {
    width: 400px;
    height: 400px;
    background: var(--color-right);
    bottom: -100px;
    right: -100px;
}

/* --- 3. 메인 게임 컨테이너 --- */
.game-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 460px;
    height: 92vh;
    max-height: 820px;
    margin: 0 16px;
    display: flex;
    flex-direction: column;
}


/* --- 4. 화면 전환 --- */
.screen {
    display: none;
    width: 100%;
    height: 100%;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease-in-out;
}
.screen.active {
    display: flex;
}

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

/* --- 5. 글래스모피즘 카드 --- */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    padding: 28px 22px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* 로비 헤더: 보유 코인 및 상점 버튼 */
.lobby-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    background: rgba(0, 0, 0, 0.25);
    padding: 8px 16px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.coin-badge {
    font-size: 1.1rem;
    font-weight: 800;
    color: #facc15;
    text-shadow: 0 0 10px rgba(250, 204, 21, 0.4);
}

.btn-shop {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
    padding: 6px 14px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 800;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.4);
    transition: transform 0.15s ease;
}

.btn-shop:hover {
    transform: translateY(-2px);
}

.game-badge {
    display: inline-block;
    background: rgba(168, 85, 247, 0.2);
    color: #c084fc;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 10px;
    border: 1px solid rgba(192, 132, 252, 0.3);
}

.game-title {
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 6px;
    background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.game-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 20px;
    line-height: 1.4;
}

.section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 10px;
}

/* --- 6. 난이도 선택 버튼 --- */
.difficulty-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.diff-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s ease;
}

.diff-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.diff-btn.active {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.3) 0%, rgba(59, 130, 246, 0.3) 100%);
    border-color: #c084fc;
    box-shadow: 0 0 15px rgba(192, 132, 252, 0.4);
}

/* 하드모드 버튼 전용 스타일 (잠금 & 해금) */
.diff-btn.diff-hardmode {
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.08);
}

.diff-btn.diff-hardmode:hover {
    background: rgba(239, 68, 68, 0.18);
    border-color: #ef4444;
}

.diff-btn.diff-hardmode.locked {
    background: rgba(239, 68, 68, 0.05);
    border: 2px dashed rgba(239, 68, 68, 0.4);
}

.diff-btn.diff-hardmode.locked .diff-name {
    color: #fca5a5;
}

.diff-btn.diff-hardmode.locked .diff-info {
    color: #f87171;
    font-weight: 700;
}

.diff-btn.diff-hardmode.active {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.4) 0%, rgba(185, 28, 28, 0.5) 100%);
    border-color: #ef4444;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.6);
}

/* 무한모드 버튼 전용 스타일 */
.diff-btn.diff-endless {
    border-color: rgba(6, 182, 212, 0.4);
    background: rgba(6, 182, 212, 0.08);
}

.diff-btn.diff-endless:hover {
    background: rgba(6, 182, 212, 0.18);
    border-color: #06b6d4;
}

.diff-btn.diff-endless.active {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.4) 0%, rgba(168, 85, 247, 0.4) 100%);
    border-color: #06b6d4;
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.6);
}

/* 불가능 단계 전용 스타일 (Hidden Impossible Mode) */
.diff-btn.hidden {
    display: none !important;
}

.diff-btn.diff-impossible {
    border-color: rgba(168, 85, 247, 0.6);
    background: linear-gradient(135deg, rgba(88, 28, 135, 0.3) 0%, rgba(15, 23, 42, 0.8) 100%);
    animation: fadeInImpossible 0.4s ease;
}

@keyframes fadeInImpossible {
    from { opacity: 0; transform: scale(0.9) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.diff-btn.diff-impossible:hover {
    background: linear-gradient(135deg, rgba(126, 34, 206, 0.5) 0%, rgba(15, 23, 42, 0.9) 100%);
    border-color: #c084fc;
}

.diff-btn.diff-impossible.active {
    background: linear-gradient(135deg, #7e22ce 0%, #3b0764 100%);
    border-color: #e9d5ff;
    box-shadow: 0 0 25px rgba(168, 85, 247, 0.8);
}

/* 게임 상단 종료 버튼 스타일 */
.btn-stop-game {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.5);
    border-radius: 10px;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-stop-game:hover {
    background: #ef4444;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
    transform: scale(1.05);
}

.diff-name { font-size: 0.95rem; font-weight: 700; }
.diff-info { font-size: 0.8rem; color: var(--text-muted); }

/* --- 7. 컨트롤 안내 및 버튼 --- */
.controls-guide {
    background: rgba(0, 0, 0, 0.25);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    text-align: left;
}

.key-cap {
    background: rgba(255, 255, 255, 0.15);
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 800;
    font-size: 1rem;
    color: #38bdf8;
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin: 0 2px;
}

.guide-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.btn {
    border: none;
    border-radius: 14px;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-left) 0%, var(--color-up) 100%);
    color: #fff;
    box-shadow: 0 8px 20px rgba(168, 85, 247, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-large {
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
}

/* --- 8. 게임 플레이 화면 --- */
#gameScreen {
    justify-content: space-between;
    padding: 12px 0;
}

.game-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    padding: 12px 18px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.info-box {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.info-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
}

.info-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
}

.combo-value {
    font-size: 1.3rem;
    font-weight: 900;
    color: #facc15;
    text-shadow: 0 0 10px rgba(250, 204, 21, 0.5);
}

.judgment-display {
    height: 38px;
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.judgment-display.perfect { color: var(--perfect-color); text-shadow: 0 0 15px var(--perfect-color); }
.judgment-display.good { color: var(--good-color); text-shadow: 0 0 15px var(--good-color); }
.judgment-display.miss { color: var(--miss-color); text-shadow: 0 0 15px var(--miss-color); }
.judgment-display.holding { color: #facc15; text-shadow: 0 0 15px #facc15; }

/* --- 9. 트랙 메인 공간 --- */
.track-container {
    position: relative;
    width: 100%;
    height: 400px;
    background: rgba(15, 23, 42, 0.85);
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.7);
}

.lane-guides {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    pointer-events: none;
}

.lane-col {
    border-right: 1px dashed rgba(255, 255, 255, 0.08);
    height: 100%;
}
.lane-col:last-child { border-right: none; }

.target-line {
    position: absolute;
    bottom: 50px;
    left: 0;
    width: 100%;
    height: 64px;
    border-top: 3px solid #38bdf8;
    border-bottom: 3px solid #38bdf8;
    background: rgba(56, 189, 248, 0.12);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    align-items: center;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.3);
}

.target-slot {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.35);
    transition: all 0.1s ease;
}

.slot-left { color: var(--color-left); opacity: 0.6; }
.slot-up { color: var(--color-up); opacity: 0.6; }
.slot-down { color: var(--color-down); opacity: 0.6; }
.slot-right { color: var(--color-right); opacity: 0.6; }

.target-slot.holding {
    animation: holdPulse 0.15s infinite alternate;
    text-shadow: 0 0 15px #facc15;
    color: #fff !important;
}

@keyframes holdPulse {
    from { transform: scale(1.0); filter: brightness(1.2); }
    to { transform: scale(1.2); filter: brightness(1.8); }
}

.note-area {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* --- 10. 노트 디자인 (동적 테마 전용 색상 적용) --- */
.beat-note {
    position: absolute;
    transform: translateX(-50%);
    width: 58px;
    height: 58px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.7rem;
    font-weight: 900;
    color: #ffffff;
    border: 3px solid #ffffff;
    z-index: 2;
    transition: background 0.3s ease;
}

.beat-note.is-long-note {
    height: 160px;
    border-radius: 28px;
    align-items: flex-end;
    padding-bottom: 12px;
}

.beat-note.dir-ArrowLeft {
    left: 12.5%;
    background: radial-gradient(circle, var(--color-left) 0%, rgba(0, 0, 0, 0.6) 100%);
    box-shadow: 0 0 20px var(--color-left);
}
.beat-note.dir-ArrowUp {
    left: 37.5%;
    background: radial-gradient(circle, var(--color-up) 0%, rgba(0, 0, 0, 0.6) 100%);
    box-shadow: 0 0 20px var(--color-up);
}
.beat-note.dir-ArrowDown {
    left: 62.5%;
    background: radial-gradient(circle, var(--color-down) 0%, rgba(0, 0, 0, 0.6) 100%);
    box-shadow: 0 0 20px var(--color-down);
}
.beat-note.dir-ArrowRight {
    left: 87.5%;
    background: radial-gradient(circle, var(--color-right) 0%, rgba(0, 0, 0, 0.6) 100%);
    box-shadow: 0 0 20px var(--color-right);
}

.beat-note.is-long-note.dir-ArrowLeft { background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, var(--color-left) 100%); }
.beat-note.is-long-note.dir-ArrowUp { background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, var(--color-up) 100%); }
.beat-note.is-long-note.dir-ArrowDown { background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, var(--color-down) 100%); }
.beat-note.is-long-note.dir-ArrowRight { background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, var(--color-right) 100%); }

/* --- 11. 하단 패드 --- */
.arrow-pad {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.arrow-btn {
    background: rgba(30, 41, 59, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 16px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    cursor: pointer;
    transition: all 0.1s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.arrow-icon { font-size: 1.8rem; font-weight: 900; }

.btn-left { border-bottom: 4px solid var(--color-left); }
.btn-up { border-bottom: 4px solid var(--color-up); }
.btn-down { border-bottom: 4px solid var(--color-down); }
.btn-right { border-bottom: 4px solid var(--color-right); }

.arrow-btn:active, .arrow-btn.active { transform: translateY(3px) scale(0.95); }

.btn-left:active, .btn-left.active { background: var(--color-left); box-shadow: 0 0 20px var(--color-left); }
.btn-up:active, .btn-up.active { background: var(--color-up); box-shadow: 0 0 20px var(--color-up); }
.btn-down:active, .btn-down.active { background: var(--color-down); box-shadow: 0 0 20px var(--color-down); }
.btn-right:active, .btn-right.active { background: var(--color-right); box-shadow: 0 0 20px var(--color-right); }

/* --- 12. 결과 화면 코인 표시 --- */
.earned-coins {
    margin-top: 8px;
    font-size: 1.1rem;
    font-weight: 800;
    color: #facc15;
    text-shadow: 0 0 10px rgba(250, 204, 21, 0.5);
}

.result-card { padding: 28px 22px; }
.result-badge { color: #facc15; font-weight: 800; font-size: 0.9rem; }
.result-title { font-size: 1.8rem; font-weight: 900; margin: 6px 0 16px 0; }

.final-score-box {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.score-label { font-size: 0.85rem; color: var(--text-muted); display: block; margin-bottom: 4px; }
.final-score { font-size: 2.5rem; font-weight: 900; color: #38bdf8; text-shadow: 0 0 15px rgba(56, 189, 248, 0.5); }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.stat-item { background: rgba(255, 255, 255, 0.05); padding: 10px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; }
.stat-name { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); margin-bottom: 4px; }
.stat-num { font-size: 1.2rem; font-weight: 800; }

.stat-item.perfect .stat-num { color: var(--perfect-color); }
.stat-item.good .stat-num { color: var(--good-color); }
.stat-item.miss .stat-num { color: var(--miss-color); }
.stat-item.combo .stat-num { color: #facc15; }

.result-actions { display: flex; flex-direction: column; gap: 10px; }

/* ======================================================
   🛒 13. 상점 모달 (Shop Modal) 팝업 디자인
   ====================================================== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    z-index: 100;
    display: none;
    justify-content: center;
    align-items: center;
}
.modal-overlay.active { display: flex; }

.shop-card {
    position: relative;
    max-width: 440px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 28px 20px;
}

.modal-close-btn {
    position: absolute;
    top: 16px; right: 20px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.8rem;
    cursor: pointer;
}
.modal-close-btn:hover { color: #fff; }

.shop-title { font-size: 1.6rem; font-weight: 900; margin-bottom: 6px; }
.shop-desc { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 14px; }

.shop-coin-status {
    background: rgba(250, 204, 21, 0.15);
    border: 1px solid rgba(250, 204, 21, 0.3);
    color: #facc15;
    padding: 10px;
    border-radius: 12px;
    font-weight: 800;
    margin-bottom: 20px;
}

/* 상점 아이템 그리드 목록 */
.shop-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.shop-item-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.2s ease;
}

.shop-item-card:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.08); }

.item-info { text-align: left; }
.item-title { font-size: 1rem; font-weight: 800; margin-bottom: 6px; }

/* 테마 프리뷰 색상 동그라미들 */
.color-preview-row {
    display: flex;
    gap: 6px;
}
.preview-dot {
    width: 14px; height: 14px; border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.item-action { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.item-price { font-size: 0.85rem; font-weight: 800; color: #facc15; }

.btn-buy {
    background: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
}

.btn-equip {
    background: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
}

.btn-equipped {
    background: rgba(255, 255, 255, 0.15);
    color: #4ade80;
    border: 1px solid #4ade80;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 800;
    cursor: default;
}
