/* ===== Global Reset & Variables ===== */
:root {
    --primary-color: #FF6B9D;
    --primary-light: #FFB3CC;
    --secondary-color: #4ECDC4;
    --secondary-light: #A8E6CF;
    --accent-color: #FFE66D;
    --accent-orange: #FF8C42;
    --bg-gradient: linear-gradient(135deg, #E0F4FF 0%, #FFF0F5 50%, #E8F5E9 100%);
    --card-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    --btn-shadow: 0 6px 20px rgba(255, 107, 157, 0.4);
    --text-dark: #2D3436;
    --text-light: #636E72;
    --white: #FFFFFF;
    --border-radius: 20px;
    --border-radius-lg: 30px;
    --font-main: 'Jua', 'Noto Sans KR', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-main);
    background: var(--bg-gradient);
    touch-action: manipulation;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
}

#app {
    width: 100%;
    height: 100%;
    max-width: 1366px;
    max-height: 1024px;
    position: relative;
    overflow: hidden;
}

/* ===== Screen Base ===== */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    opacity: 0;
    transition: opacity 0.5s ease;
    overflow: hidden;
}

.screen.active {
    display: flex;
    opacity: 1;
    z-index: 10;
}

/* ===== Button Styles ===== */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-orange));
    color: var(--white);
    border: none;
    padding: 20px 50px;
    font-size: 28px;
    font-family: var(--font-main);
    border-radius: 50px;
    cursor: pointer;
    box-shadow: var(--btn-shadow);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
    min-width: 280px;
    justify-content: center;
}

.btn-primary:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 12px 30px rgba(255, 107, 157, 0.5);
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary-color), #45B7AA);
    color: var(--white);
    border: none;
    padding: 15px 35px;
    font-size: 22px;
    font-family: var(--font-main);
    border-radius: 40px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(78, 205, 196, 0.4);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    transform: translateY(-3px);
}

.btn-back {
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-dark);
    border: 3px solid var(--primary-light);
    padding: 12px 25px;
    font-size: 20px;
    font-family: var(--font-main);
    border-radius: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-back:hover {
    background: var(--primary-light);
    color: var(--white);
}

.btn-icon-only {
    background: rgba(255, 255, 255, 0.9);
    border: 3px solid var(--accent-color);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    font-size: 28px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-only:hover {
    transform: scale(1.1);
    background: var(--accent-color);
}

/* ===== Start Screen ===== */
#start-screen {
    background: linear-gradient(180deg, #87CEEB 0%, #E0F4FF 50%, #FFF0F5 100%);
    justify-content: center;
    align-items: center;
}

.start-container {
    text-align: center;
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.logo-container {
    max-width: 80%;
    max-height: 60%;
    margin-bottom: 30px;
}

.cover-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.2));
    animation: float 3s ease-in-out infinite;
}

.rainbow {
    position: absolute;
    top: 5%;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 100px;
    background: linear-gradient(180deg, 
        rgba(255, 0, 0, 0.3),
        rgba(255, 165, 0, 0.3),
        rgba(255, 255, 0, 0.3),
        rgba(0, 128, 0, 0.3),
        rgba(0, 0, 255, 0.3),
        rgba(75, 0, 130, 0.3),
        rgba(238, 130, 238, 0.3)
    );
    border-radius: 50% 50% 0 0;
    opacity: 0.5;
}

.clouds {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.cloud {
    position: absolute;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50px;
}

.cloud::before, .cloud::after {
    content: '';
    position: absolute;
    background: inherit;
    border-radius: 50%;
}

.cloud-1 {
    width: 120px;
    height: 40px;
    top: 10%;
    left: 10%;
    animation: cloud-float 20s linear infinite;
}

.cloud-1::before {
    width: 50px;
    height: 50px;
    top: -25px;
    left: 20px;
}

.cloud-1::after {
    width: 40px;
    height: 40px;
    top: -20px;
    left: 55px;
}

.cloud-2 {
    width: 150px;
    height: 50px;
    top: 15%;
    right: 15%;
    animation: cloud-float 25s linear infinite reverse;
}

.cloud-2::before {
    width: 60px;
    height: 60px;
    top: -30px;
    left: 25px;
}

.cloud-2::after {
    width: 50px;
    height: 50px;
    top: -25px;
    left: 70px;
}

.cloud-3 {
    width: 100px;
    height: 35px;
    top: 8%;
    left: 40%;
    animation: cloud-float 18s linear infinite;
}

.cloud-3::before {
    width: 40px;
    height: 40px;
    top: -20px;
    left: 15px;
}

.cloud-3::after {
    width: 35px;
    height: 35px;
    top: -15px;
    left: 45px;
}

.decorations {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.deco {
    position: absolute;
    font-size: 40px;
    animation: bounce-float 4s ease-in-out infinite;
}

.deco-1 { bottom: 15%; left: 10%; animation-delay: 0s; }
.deco-2 { bottom: 20%; right: 10%; animation-delay: 0.5s; }
.deco-3 { top: 25%; left: 5%; animation-delay: 1s; }
.deco-4 { top: 30%; right: 5%; animation-delay: 1.5s; }

/* ===== Character Selection Screen ===== */
#character-screen {
    background: var(--bg-gradient);
    flex-direction: column;
    padding: 20px;
}

.character-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.header-section {
    text-align: center;
    margin-bottom: 20px;
}

.title {
    font-size: 36px;
    color: var(--text-dark);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    font-size: 20px;
    color: var(--text-light);
    margin-top: 8px;
}

.character-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    max-width: 750px;
    padding: 10px;
    margin: 0 auto;
}

.character-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--card-shadow);
    border: 4px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.character-card:hover {
    transform: translateY(-10px) scale(1.02);
    border-color: var(--primary-color);
    box-shadow: 0 15px 40px rgba(255, 107, 157, 0.3);
}

.character-card.selected {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #FFF0F5, #FFE4EC);
}

.character-image-wrapper {
    width: 140px;
    height: 160px;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    margin-bottom: 10px;
    border: 3px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.character-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

.baro-bg { background: linear-gradient(135deg, #FFE4B5, #FFDAB9); }
.jion-bg { background: linear-gradient(135deg, #B0E0E6, #87CEEB); }
.luon-bg { background: linear-gradient(135deg, #98FB98, #90EE90); }
.aeun-bg { background: linear-gradient(135deg, #FFB6C1, #FFC0CB); }
.arin-bg { background: linear-gradient(135deg, #FFFACD, #FAFAD2); }
.seolgi-bg { background: linear-gradient(135deg, #DEB887, #D2B48C); }

.character-avatar {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: url('../assets/characters/intro.png');
    background-repeat: no-repeat;
    transition: transform 0.3s ease;
}

/* 각 캐릭터별 위치 조정 - intro.png에서 개별 캐릭터 영역 (2행 3열 그리드) */
/* 바로(왼쪽 위), 지온(가운데 위), 루온(오른쪽 위) */
/* 아은(왼쪽 아래), 아린(가운데 아래), 설기(오른쪽 아래) */
.baro-avatar { 
    background-size: 300% 200%; 
    background-position: 0% 0%; 
}
.jion-avatar { 
    background-size: 300% 200%; 
    background-position: 50% 0%; 
}
.luon-avatar { 
    background-size: 300% 200%; 
    background-position: 100% 0%; 
}
.aeun-avatar { 
    background-size: 300% 200%; 
    background-position: 0% 100%; 
}
.arin-avatar { 
    background-size: 300% 200%; 
    background-position: 50% 100%; 
}
.seolgi-avatar { 
    background-size: 300% 200%; 
    background-position: 100% 100%; 
}

.character-card:hover .character-avatar {
    transform: scale(1.05);
}

.character-info {
    text-align: center;
}

.character-name {
    display: block;
    font-size: 18px;
    font-weight: bold;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.character-trait {
    display: block;
    font-size: 14px;
    color: var(--text-light);
}

.intro-image-container {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 200px;
    opacity: 0.3;
}

.intro-image {
    width: 100%;
}

/* ===== Map Screen ===== */
#map-screen {
    background: linear-gradient(180deg, #87CEEB 0%, #98D8C8 50%, #A8E6CF 100%);
    flex-direction: column;
}

.map-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 15px;
    position: relative;
}

.map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: var(--border-radius);
    margin-bottom: 15px;
}

.selected-character-mini {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-light);
    border: 3px solid var(--white);
    background-size: cover;
    background-position: center;
}

.map-title {
    font-size: 32px;
    color: var(--text-dark);
}

.btn-passport {
    background: linear-gradient(135deg, #8B4513, #A0522D);
    color: var(--white);
    border: none;
    padding: 12px 20px;
    border-radius: 15px;
    font-size: 18px;
    font-family: var(--font-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-passport:hover {
    transform: scale(1.05);
}

.world-map {
    flex: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.map-background {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0.3;
    overflow: hidden;
    border-radius: var(--border-radius-lg);
}

.living-room-bg {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.countries-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    max-width: 800px;
    z-index: 5;
}

.country-btn {
    background: var(--white);
    border: 4px solid var(--secondary-light);
    border-radius: var(--border-radius);
    padding: 20px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 130px;
    box-shadow: var(--card-shadow);
}

.country-btn:hover {
    transform: translateY(-8px) scale(1.05);
    border-color: var(--primary-color);
    box-shadow: 0 15px 40px rgba(255, 107, 157, 0.3);
}

.country-btn .flag {
    font-size: 48px;
}

.country-btn .country-name {
    font-size: 18px;
    font-weight: bold;
    color: var(--text-dark);
    font-family: var(--font-main);
}

.country-progress {
    display: flex;
    gap: 5px;
}

.progress-dots::before {
    content: '○ ○ ○';
    font-size: 12px;
    color: var(--text-light);
}

.country-btn.complete-1 .progress-dots::before { content: '● ○ ○'; color: var(--primary-color); }
.country-btn.complete-2 .progress-dots::before { content: '● ● ○'; color: var(--primary-color); }
.country-btn.complete-3 .progress-dots::before { content: '● ● ●'; color: var(--secondary-color); }

.character-guide {
    position: absolute;
    bottom: 20px;
    left: 20px;
    display: flex;
    align-items: flex-end;
    gap: 15px;
}

.speech-bubble {
    background: var(--white);
    border-radius: 20px;
    padding: 15px 25px;
    position: relative;
    box-shadow: var(--card-shadow);
    max-width: 300px;
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 30px;
    border-width: 15px 10px 0;
    border-style: solid;
    border-color: var(--white) transparent transparent;
}

.speech-bubble p {
    font-size: 18px;
    color: var(--text-dark);
}

.speech-bubble.small {
    padding: 10px 15px;
}

.speech-bubble.small p {
    font-size: 14px;
}

/* ===== Landmark Selection Screen ===== */
#landmark-screen {
    background: var(--bg-gradient);
    flex-direction: column;
    padding: 20px;
}

.landmark-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.landmark-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.landmark-title {
    font-size: 32px;
    color: var(--text-dark);
}

.landmarks-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    padding: 20px;
    max-width: 900px;
    margin: 0 auto;
    align-items: start;
}

.landmark-card {
    background: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--card-shadow);
    border: 4px solid transparent;
    display: flex;
    flex-direction: column;
    aspect-ratio: 1 / 1;
    position: relative;
}

.landmark-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary-color);
}

.landmark-card.completed {
    border-color: var(--secondary-color);
}

.landmark-card.completed::after {
    content: '✅';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 30px;
}

.landmark-image {
    width: 100%;
    height: 70%;
    object-fit: cover;
}

.landmark-info {
    padding: 12px;
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.landmark-name {
    font-size: 20px;
    font-weight: bold;
    color: var(--text-dark);
}

.landmark-city {
    font-size: 14px;
    color: var(--text-light);
    margin-top: 5px;
}

.character-encouragement {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.encouragement-character {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

/* ===== Difficulty Selection Screen ===== */
#difficulty-screen {
    background: var(--bg-gradient);
    flex-direction: column;
    padding: 20px;
    justify-content: center;
    align-items: center;
}

.difficulty-container {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.difficulty-header {
    display: flex;
    align-items: center;
    gap: 20px;
    width: 100%;
    margin-bottom: 30px;
}

.difficulty-title {
    font-size: 32px;
    color: var(--text-dark);
}

.landmark-preview {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--card-shadow);
    text-align: center;
    margin-bottom: 30px;
}

.preview-image {
    max-width: 300px;
    max-height: 200px;
    border-radius: 15px;
    object-fit: cover;
}

.preview-name {
    font-size: 24px;
    color: var(--text-dark);
    margin-top: 15px;
}

.difficulty-options {
    display: flex;
    gap: 25px;
}

.difficulty-btn {
    background: var(--white);
    border: 4px solid var(--secondary-light);
    border-radius: var(--border-radius);
    padding: 25px 35px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-width: 160px;
    box-shadow: var(--card-shadow);
}

.difficulty-btn:hover {
    transform: translateY(-10px);
    border-color: var(--primary-color);
}

.difficulty-stars {
    font-size: 32px;
}

.difficulty-label {
    font-size: 24px;
    font-weight: bold;
    color: var(--text-dark);
    font-family: var(--font-main);
}

.difficulty-pieces {
    font-size: 16px;
    color: var(--text-light);
    font-family: var(--font-main);
}

/* ===== Puzzle Screen ===== */
#puzzle-screen {
    background: linear-gradient(135deg, #E8F5E9 0%, #E0F4FF 100%);
    flex-direction: column;
}

.puzzle-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 15px;
}

.puzzle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: var(--border-radius);
    margin-bottom: 15px;
}

.puzzle-title {
    font-size: 28px;
    color: var(--text-dark);
}

.puzzle-area {
    flex: 1;
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: center;
}

.guide-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.guide-image {
    width: 200px;
    height: auto;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    opacity: 0.7;
    border: 4px dashed var(--secondary-color);
}

.guide-image img {
    width: 100%;
    height: auto;
}

.guide-text {
    font-size: 16px;
    color: var(--text-light);
}

.puzzle-board {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--card-shadow);
    display: grid;
    gap: 5px;
    min-width: 400px;
    min-height: 400px;
}

.puzzle-piece {
    background-size: cover;
    background-position: center;
    border-radius: 8px;
    cursor: grab;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.puzzle-piece:hover {
    transform: scale(1.05);
    border-color: var(--primary-color);
    z-index: 10;
}

.puzzle-piece.dragging {
    cursor: grabbing;
    transform: scale(1.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 100;
}

.puzzle-piece.correct {
    border-color: var(--secondary-color);
    box-shadow: 0 0 15px rgba(78, 205, 196, 0.5);
}

.puzzle-piece.hint {
    animation: hint-glow 1s ease-in-out infinite;
}

/* 🎯 정답 위치 넛지 - 드래그 중 정답 위치에 가까워지면 표시 */
.puzzle-piece.correct-position-hint {
    border: 4px solid #FFD700 !important;
    box-shadow: 
        0 0 20px rgba(255, 215, 0, 0.8),
        0 0 40px rgba(255, 215, 0, 0.5),
        0 0 60px rgba(255, 215, 0, 0.3),
        inset 0 0 20px rgba(255, 215, 0, 0.2) !important;
    animation: correct-position-glow 0.5s ease-in-out infinite alternate !important;
    transform: scale(1.02);
    z-index: 50;
}

/* 정답 위치 반짝임 애니메이션 */
@keyframes correct-position-glow {
    0% {
        border-color: #FFD700;
        box-shadow: 
            0 0 20px rgba(255, 215, 0, 0.8),
            0 0 40px rgba(255, 215, 0, 0.5),
            0 0 60px rgba(255, 215, 0, 0.3),
            inset 0 0 20px rgba(255, 215, 0, 0.2);
    }
    100% {
        border-color: #FFA500;
        box-shadow: 
            0 0 30px rgba(255, 165, 0, 1),
            0 0 50px rgba(255, 215, 0, 0.7),
            0 0 70px rgba(255, 215, 0, 0.4),
            inset 0 0 30px rgba(255, 215, 0, 0.3);
    }
}

.puzzle-character {
    position: absolute;
    bottom: 20px;
    left: 20px;
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.cheering-character {
    width: 100px;
    height: 100px;
    object-fit: contain;
    animation: bounce-small 2s ease-in-out infinite;
}

/* ===== NEW Puzzle UI (좌우 분리 레이아웃) ===== */
.puzzle-layout {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 헤더 바 */
.puzzle-header-bar {
    background: linear-gradient(135deg, #FFB347, #FF8C42);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(255, 140, 66, 0.3);
    flex-shrink: 0;
}

.btn-back-circle {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-back-circle:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.puzzle-title-bar {
    font-size: 24px;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-hint-circle {
    padding: 10px 18px;
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: white;
    font-size: 15px;
    font-family: var(--font-main);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-hint-circle:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

/* 메인 영역 (좌우 분리) */
.puzzle-main {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

/* 좌측: 퍼즐 보드 (65%) */
.puzzle-board-section {
    flex: 0 0 65%;
    background: linear-gradient(180deg, #E8F4FD 0%, #D4ECFA 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.puzzle-board-wrapper {
    background: white;
    border-radius: 16px;
    padding: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    display: grid;
    gap: 5px;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
}

/* 우측: 조각 + 캐릭터 (35%) */
.puzzle-side-section {
    flex: 0 0 35%;
    background: linear-gradient(180deg, #FFF8E7 0%, #FFE4B5 100%);
    display: flex;
    flex-direction: column;
    padding: 15px;
    overflow: hidden;
}

/* 퍼즐 조각 그리드 (2열) */
.puzzle-pieces-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 10px;
    overflow-y: auto;
    align-content: start;
}

/* 캐릭터 응원 영역 */
.puzzle-cheer-section {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 15px;
    margin-top: 10px;
}

.cheer-character-box {
    flex-shrink: 0;
}

.cheer-avatar-box {
    width: 70px;
    height: 85px;
    background-image: url('../assets/characters/intro.png');
    background-size: 300% 200%;
    background-position: 0% 0%;
    border-radius: 10px;
    border: 3px solid white;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

.cheer-speech-box {
    background: white;
    padding: 10px 14px;
    border-radius: 15px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    position: relative;
    flex: 1;
}

.cheer-speech-box::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    border: 8px solid transparent;
    border-right-color: white;
}

.cheer-speech-box p {
    font-size: 14px;
    color: var(--text-dark);
    margin: 0;
    line-height: 1.4;
}

/* 빈 슬롯 스타일 */
.puzzle-slot {
    background: rgba(200, 220, 240, 0.4);
    border: 3px dashed #A8C5DA;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

.puzzle-slot.empty {
    background: rgba(200, 220, 240, 0.4);
}

.puzzle-slot.filled {
    border: 2px solid rgba(78, 205, 196, 0.5);
    background: transparent;
}

.puzzle-slot.filled .puzzle-piece-in-slot {
    width: 100%;
    height: 100%;
    border-radius: 6px;
    background-size: cover;
    background-position: center;
}

/* 슬롯 정답 위치 넛지 */
.puzzle-slot.correct-position-hint {
    border: 4px solid #FFD700 !important;
    background: rgba(255, 215, 0, 0.2) !important;
    box-shadow: 
        0 0 20px rgba(255, 215, 0, 0.8),
        0 0 40px rgba(255, 215, 0, 0.5),
        inset 0 0 20px rgba(255, 215, 0, 0.3) !important;
    animation: slot-glow 0.5s ease-in-out infinite alternate !important;
}

@keyframes slot-glow {
    0% {
        border-color: #FFD700;
        box-shadow: 
            0 0 20px rgba(255, 215, 0, 0.8),
            0 0 40px rgba(255, 215, 0, 0.5),
            inset 0 0 20px rgba(255, 215, 0, 0.3);
    }
    100% {
        border-color: #FFA500;
        box-shadow: 
            0 0 30px rgba(255, 165, 0, 1),
            0 0 50px rgba(255, 215, 0, 0.7),
            inset 0 0 30px rgba(255, 215, 0, 0.4);
    }
}

/* 퍼즐 조각 스타일 (우측 패널) */
.puzzle-piece-draggable {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    background-size: cover;
    background-position: center;
    cursor: grab;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border: 3px solid white;
}

.puzzle-piece-draggable:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    border-color: var(--primary-color);
}

.puzzle-piece-draggable.dragging {
    cursor: grabbing;
    transform: scale(1.1);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    border-color: var(--accent-color);
    position: fixed;
}

.puzzle-piece-draggable.placed {
    display: none;
}

/* ❌ 틀렸을 때 피드백 애니메이션 */
.puzzle-piece-draggable.wrong-shake {
    animation: wrong-shake 0.4s ease-in-out;
    border-color: #FF6B6B !important;
}

@keyframes wrong-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-10px) rotate(-3deg); }
    40% { transform: translateX(10px) rotate(3deg); }
    60% { transform: translateX(-10px) rotate(-3deg); }
    80% { transform: translateX(10px) rotate(3deg); }
}

/* 슬롯 틀림 표시 */
.puzzle-slot.wrong-position {
    border-color: #FF6B6B !important;
    background: rgba(255, 107, 107, 0.2) !important;
    animation: slot-wrong 0.5s ease-in-out;
}

@keyframes slot-wrong {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(0.95); }
}

/* 캐릭터 아바타 위치 (intro.png 기반) */
.cheer-avatar-box.baro { background-position: 0% 0%; }
.cheer-avatar-box.jion { background-position: 50% 0%; }
.cheer-avatar-box.luon { background-position: 100% 0%; }
.cheer-avatar-box.aeun { background-position: 0% 100%; }
.cheer-avatar-box.arin { background-position: 50% 100%; }
.cheer-avatar-box.seolgi { background-position: 100% 100%; }
}

.speech-bubble-new {
    background: white;
    padding: 12px 20px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    position: relative;
    max-width: 200px;
}

.speech-bubble-new::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    border: 10px solid transparent;
    border-right-color: white;
}

.speech-bubble-new p {
    font-size: 16px;
    color: var(--text-dark);
    margin: 0;
}

/* 완료된 조각 표시 */
.puzzle-slot.completed {
    border: 3px solid var(--secondary-color);
    box-shadow: 0 0 15px rgba(78, 205, 196, 0.5);
}

/* ===== Complete Screen ===== */
#complete-screen {
    background: linear-gradient(135deg, #FFE4EC, #E8F5E9, #E0F4FF);
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.complete-container {
    text-align: center;
    padding: 30px;
    position: relative;
}

.complete-title {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 20px;
    animation: bounce-in 0.5s ease;
}

.completed-image {
    margin: 20px auto;
    max-width: 400px;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

.completed-image img {
    width: 100%;
    height: auto;
}

.story-section {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 25px;
    margin: 20px auto;
    max-width: 600px;
    box-shadow: var(--card-shadow);
}

.story-title {
    font-size: 24px;
    color: var(--text-dark);
    margin-bottom: 15px;
}

.story-bubble {
    background: linear-gradient(135deg, #FFF9C4, #FFFDE7);
    border-radius: 20px;
    padding: 20px;
    border: 3px dashed var(--accent-color);
}

.story-text {
    font-size: 18px;
    line-height: 1.6;
    color: var(--text-dark);
}

.sticker-earned {
    font-size: 24px;
    color: var(--secondary-color);
    margin: 20px 0;
    animation: pulse 1s ease-in-out infinite;
}

.complete-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 20px;
}

.complete-character {
    position: absolute;
    bottom: 20px;
    right: 20px;
}

.complete-character img {
    width: 150px;
    height: auto;
    animation: jump-celebrate 0.5s ease-in-out infinite;
}

/* ===== Passport Screen ===== */
#passport-screen {
    background: linear-gradient(135deg, #8B4513, #A0522D);
    flex-direction: column;
    padding: 20px;
}

.passport-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.passport-header {
    display: flex;
    align-items: center;
    gap: 20px;
    width: 100%;
    margin-bottom: 20px;
}

.passport-title {
    font-size: 32px;
    color: var(--white);
}

.passport-book {
    flex: 1;
    background: linear-gradient(135deg, #F5DEB3, #DEB887);
    border-radius: 15px;
    padding: 30px;
    max-width: 800px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.passport-cover {
    text-align: center;
    margin-bottom: 20px;
}

.passport-cover h2 {
    font-size: 28px;
    color: #8B4513;
}

.passport-character {
    width: 100px;
    height: 120px;
    margin: 15px auto;
    border-radius: 15px;
    background-color: var(--white);
    background-image: url('../assets/characters/intro.png');
    background-repeat: no-repeat;
    border: 4px solid #8B4513;
    overflow: hidden;
}

.passport-pages {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding: 5px;
}

.passport-page {
    background: var(--white);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.passport-page .country-flag {
    font-size: 40px;
}

.passport-page .country-name {
    font-size: 16px;
    font-weight: bold;
    margin: 10px 0;
}

.sticker-slots {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.sticker-slot {
    width: 40px;
    height: 40px;
    border: 2px dashed var(--text-light);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--text-light);
}

.sticker-slot.earned {
    border: none;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-orange));
}

.sticker-slot.earned::after {
    content: '⭐';
    font-size: 24px;
}

/* 페이지네이션 제거됨 - 9개 국가를 한 화면에 모두 표시 */

.page-indicator {
    color: var(--white);
    font-size: 18px;
}

/* ===== Rotate Notice ===== */
.rotate-notice {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.rotate-content {
    text-align: center;
    color: var(--white);
}

.rotate-icon {
    font-size: 80px;
    display: block;
    margin-bottom: 20px;
    animation: rotate-phone 2s ease-in-out infinite;
}

.rotate-content p {
    font-size: 24px;
    margin-bottom: 15px;
}

.rotate-arrow {
    font-size: 40px;
    display: block;
    animation: spin 2s linear infinite;
}

/* ===== 공통 캐릭터 표시 컴포넌트 ===== */
.character-display {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.character-display-avatar {
    width: 80px;
    height: 100px;
    border-radius: 15px;
    overflow: hidden;
    background-color: var(--white);
    box-shadow: var(--card-shadow);
    border: 3px solid var(--primary-light);
    position: relative;
}

.character-display-avatar.small {
    width: 50px;
    height: 65px;
    border-radius: 10px;
}

.character-display-avatar.large {
    width: 120px;
    height: 150px;
    border-radius: 20px;
}

.character-display-avatar .avatar-img {
    width: 100%;
    height: 100%;
    background-image: url('../assets/characters/intro.png');
    background-repeat: no-repeat;
}

/* 개별 캐릭터 아바타 포지션 */
.character-display-avatar .avatar-img.baro { 
    background-size: 300% 200%; 
    background-position: 0% 0%; 
}
.character-display-avatar .avatar-img.jion { 
    background-size: 300% 200%; 
    background-position: 50% 0%; 
}
.character-display-avatar .avatar-img.luon { 
    background-size: 300% 200%; 
    background-position: 100% 0%; 
}
.character-display-avatar .avatar-img.aeun { 
    background-size: 300% 200%; 
    background-position: 0% 100%; 
}
.character-display-avatar .avatar-img.arin { 
    background-size: 300% 200%; 
    background-position: 50% 100%; 
}
.character-display-avatar .avatar-img.seolgi { 
    background-size: 300% 200%; 
    background-position: 100% 100%; 
}

/* 캐릭터 + 말풍선 조합 */
.character-with-bubble {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.character-with-bubble .speech-bubble {
    margin-bottom: 15px;
}

/* 시작 화면 캐릭터 표시 영역 */
.start-characters {
    position: absolute;
    bottom: 15%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
}

/* 관광지 선택 화면 캐릭터 - 수정 */
.character-encouragement {
    position: absolute;
    bottom: 20px;
    right: 30px;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    z-index: 10;
}

.encouragement-avatar {
    width: 120px;
    height: 150px;
    border-radius: 18px;
    overflow: hidden;
    background-color: var(--white);
    box-shadow: var(--card-shadow);
    border: 4px solid var(--primary-light);
}

.encouragement-avatar .avatar-inner {
    width: 100%;
    height: 100%;
    background-image: url('../assets/characters/intro.png');
    background-repeat: no-repeat;
}

/* 퍼즐 화면 응원 캐릭터 - 개선 */
.puzzle-character {
    position: absolute;
    bottom: 15px;
    left: 15px;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    z-index: 10;
}

.cheer-avatar {
    width: 130px;
    height: 160px;
    border-radius: 18px;
    overflow: hidden;
    background-color: var(--white);
    box-shadow: var(--card-shadow);
    border: 4px solid var(--secondary-light);
    animation: bounce-small 2s ease-in-out infinite;
}

.cheer-avatar .avatar-inner {
    width: 100%;
    height: 100%;
    background-image: url('../assets/characters/intro.png');
    background-repeat: no-repeat;
}

/* 완료 화면 축하 캐릭터 */
.complete-character {
    position: absolute;
    bottom: 30px;
    right: 30px;
}

.complete-character .celebrate-avatar {
    width: 160px;
    height: 200px;
    border-radius: 22px;
    overflow: hidden;
    background-color: var(--white);
    box-shadow: var(--card-shadow);
    border: 5px solid var(--accent-color);
    animation: jump-celebrate 0.5s ease-in-out infinite;
}

.complete-character .celebrate-avatar .avatar-inner {
    width: 100%;
    height: 100%;
    background-image: url('../assets/characters/intro.png');
    background-repeat: no-repeat;
}

/* 여권 캐릭터 */
.passport-character {
    width: 130px;
    height: 160px;
    margin: 15px auto;
    border-radius: 18px;
    background-color: var(--white);
    background-image: url('../assets/characters/intro.png');
    background-repeat: no-repeat;
    border: 5px solid #8B4513;
    overflow: hidden;
}

/* 맵 화면 미니 캐릭터 */
.selected-character-mini {
    width: 70px;
    height: 90px;
    border-radius: 14px;
    background: var(--white);
    border: 3px solid var(--primary-light);
    background-image: url('../assets/characters/intro.png');
    background-repeat: no-repeat;
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
}

/* 캐릭터별 미니 아바타 위치 */
.selected-character-mini.baro { background-size: 300% 200%; background-position: 0% 0%; }
.selected-character-mini.jion { background-size: 300% 200%; background-position: 50% 0%; }
.selected-character-mini.luon { background-size: 300% 200%; background-position: 100% 0%; }
.selected-character-mini.aeun { background-size: 300% 200%; background-position: 0% 100%; }
.selected-character-mini.arin { background-size: 300% 200%; background-position: 50% 100%; }
.selected-character-mini.seolgi { background-size: 300% 200%; background-position: 100% 100%; }

/* Responsive - 세로 모드 감지 */
@media screen and (orientation: portrait) and (max-width: 1024px) {
    .rotate-notice {
        display: flex;
    }
}

/* 모바일 최적화 */
@media screen and (max-width: 768px) {
    .title {
        font-size: 28px;
    }
    
    .character-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .character-image-wrapper {
        width: 100px;
        height: 120px;
    }
    
    .countries-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
    
    .country-btn {
        padding: 15px 10px;
        min-width: 100px;
    }
    
    .country-btn .flag {
        font-size: 36px;
    }
    
    .landmarks-grid {
        gap: 15px;
    }
    
    .landmark-image {
        height: 130px;
    }
    
    .difficulty-options {
        flex-direction: column;
        gap: 15px;
    }
    
    .puzzle-board {
        min-width: 300px;
        min-height: 300px;
    }
    
    .guide-image {
        width: 150px;
    }
}
