* {
    box-sizing: border-box;
    font-family: 'Fredoka', sans-serif;
}

body {
    margin: 0;
    padding: 0;
    background: #e0e5ec;
    color: #4a4a4a;
    overflow-x: hidden;
}

/* 공통 상단 */
header.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.avatar-thumbnail {
    font-size: 2rem;
    background: #f0f0f0;
    border-radius: 50%;
    padding: 5px;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1);
}

.currency-box {
    font-size: 1.2rem;
    font-weight: bold;
    padding: 5px 15px;
    background: #ffeb3b;
    border-radius: 20px;
    box-shadow: 0 4px 0 #f5b041, inset 0 2px 5px rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    gap: 5px;
}

/* 메인 화면 컨트롤 */
.screen {
    display: none;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    min-height: 90vh;
}

.screen.active {
    display: block;
    animation: fadeIn 0.4s ease-out;
}

/* 인트로 화면 */
.intro-bg {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    display: flex !important;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.intro-content {
    text-align: center;
    background: rgba(255, 255, 255, 0.7);
    padding: 40px;
    border-radius: 30px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.intro-title {
    font-size: 2.8rem;
    color: #34495e;
    margin: 0 0 10px 0;
    line-height: 1.2;
    text-shadow: 2px 2px 0px #fff;
}

.intro-subtitle {
    font-size: 1.1rem;
    color: #7f8c8d;
    margin-bottom: 30px;
}

.intro-character {
    font-size: 5rem;
    margin-bottom: 30px;
    animation: pop 2s infinite ease-in-out;
    display: inline-block;
    filter: drop-shadow(0 10px 5px rgba(0, 0, 0, 0.2));
}

.intro-btn {
    font-size: 1.5rem;
    padding: 15px 30px;
    border-radius: 30px;
}

.intro-bg:not(.active) {
    display: none !important;
}

/* 3D 캐릭터 무대 */
.character-showcase {
    text-align: center;
    margin: 30px 0;
}

.character-platform {
    position: relative;
    display: inline-block;
}

.character-3d {
    font-size: 6rem;
    margin: 0 auto;
    filter: drop-shadow(0 10px 10px rgba(0, 0, 0, 0.3));
    transform: translateY(0);
    animation: float 3s infinite ease-in-out;
    cursor: pointer;
}

.platform-shadow {
    width: 100%;
    height: 20px;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0) 70%);
    margin-top: -10px;
    border-radius: 50%;
}

/* 애니메이션 */
@keyframes float {
    0% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* 3D 버튼 스타일 */
.btn-3d {
    border: none;
    font-size: 1rem;
    font-weight: bold;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.1s;
    padding: 12px 20px;
    color: white;
    margin: 5px;
}

.btn-3d:active {
    transform: translateY(4px);
}

.btn-secondary {
    background: #9b59b6;
    box-shadow: 0 5px 0 #8e44ad, 0 10px 10px rgba(0, 0, 0, 0.2);
}

.btn-secondary:active {
    box-shadow: 0 1px 0 #8e44ad, 0 2px 2px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: #3498db;
    box-shadow: 0 5px 0 #2980b9, 0 10px 10px rgba(0, 0, 0, 0.2);
}

.btn-primary:active {
    box-shadow: 0 1px 0 #2980b9, 0 2px 2px rgba(0, 0, 0, 0.2);
}

.btn-action {
    background: #e67e22;
    box-shadow: 0 5px 0 #d35400, 0 10px 10px rgba(0, 0, 0, 0.2);
}

.btn-action:active {
    box-shadow: 0 1px 0 #d35400, 0 2px 2px rgba(0, 0, 0, 0.2);
}

.btn-danger {
    background: #e74c3c;
    box-shadow: 0 5px 0 #c0392b, 0 10px 10px rgba(0, 0, 0, 0.2);
}

.btn-danger:active {
    box-shadow: 0 1px 0 #c0392b, 0 2px 2px rgba(0, 0, 0, 0.2);
}

.btn-large {
    width: 100%;
    margin: 10px 0;
    font-size: 1.2rem;
    padding: 15px;
}

.btn-icon,
.btn-circle {
    border-radius: 50%;
    width: 50px;
    height: 50px;
    padding: 0;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    background: #fff;
    color: #333;
    box-shadow: 0 4px 0 #ddd;
    border: 2px solid #ddd;
}

.btn-icon:active,
.btn-circle:active {
    box-shadow: 0 1px 0 #ddd;
    transform: translateY(3px);
}

/* 징검다리 코스 (스테이지) */
.stage-selection {
    margin-top: 10px;
}

.section-title {
    text-align: center;
    color: #2c3e50;
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.stepping-stone-path {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    padding: 20px 0;
    position: relative;
}

/* 점선 연결선 */
.stepping-stone-path::before {
    content: '';
    position: absolute;
    top: 50px;
    bottom: 50px;
    width: 6px;
    background: repeating-linear-gradient(to bottom, #bdc3c7, #bdc3c7 15px, transparent 15px, transparent 30px);
    z-index: 0;
}

/* 개별 징검다리 모양 */
.stone-container {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stone-container:nth-child(even) {
    transform: translateX(40px);
}

.stone-container:nth-child(odd) {
    transform: translateX(-40px);
}

.stone-btn {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    box-shadow: 0 10px 0 #2980b9, 0 15px 20px rgba(0, 0, 0, 0.2);
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.stone-btn:active {
    transform: translateY(5px);
    box-shadow: 0 5px 0 #2980b9, 0 10px 10px rgba(0, 0, 0, 0.2) !important;
}

/* 잠긴 스테이지 */
.stone-locked .stone-btn {
    background: #bdc3c7;
    box-shadow: 0 10px 0 #95a5a6, 0 15px 20px rgba(0, 0, 0, 0.1);
    color: #7f8c8d;
    cursor: not-allowed;
    filter: grayscale(100%);
}

.stone-locked .stone-btn:active {
    transform: none;
    box-shadow: 0 10px 0 #95a5a6, 0 15px 20px rgba(0, 0, 0, 0.1) !important;
}

.stone-label {
    margin-top: 15px;
    font-weight: bold;
    background: white;
    padding: 5px 15px;
    border-radius: 20px;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
    color: #333;
}

.stone-stars {
    margin-top: 5px;
    font-size: 0.9rem;
    color: #f1c40f;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    letter-spacing: 2px;
}

.stars-display {
    font-size: 2.5rem;
    letter-spacing: 5px;
    color: #f1c40f;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    margin: 15px 0;
}

/* 게임 화면 요소 */
.game-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.progress-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-bar {
    height: 15px;
    width: 100%;
    background: #ddd;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-bar::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: var(--progress, 0%);
    background: linear-gradient(90deg, #4facfe, #00f2fe);
    transition: width 0.3s ease;
}

.korean-text {
    font-size: 1.4rem;
    font-weight: 700;
    color: #2c3e50;
    text-align: center;
    margin-bottom: 15px;
}

.audio-controls {
    text-align: center;
    margin-bottom: 15px;
}

.answer-section {
    min-height: 80px;
    margin-bottom: 20px;
}

.answer-box {
    background: rgba(255, 255, 255, 0.8);
    border: 2px dashed #aaa;
    border-radius: 15px;
    min-height: 60px;
    padding: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

.answer-box.correct {
    border-color: #2ecc71;
    background: #e8f8f5;
    animation: pop 0.3s;
}

.answer-box.wrong {
    border-color: #e74c3c;
    background: #fdedec;
    animation: shake 0.3s;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

.word-pieces-section {
    background: #fff;
    padding: 20px;
    border-radius: 15px;
    box-shadow: inset 0 4px 6px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
    min-height: 100px;
}

.word-btn {
    background: #fff;
    color: #333;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 10px 15px;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 4px 0 #e0e0e0;
    transition: transform 0.1s, box-shadow 0.1s;
}

.word-btn:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #e0e0e0;
}

.word-btn.selected {
    visibility: hidden;
}

/* 자리 유지 */

/* 말하기 피드백 */
.speech-feedback {
    text-align: center;
    font-weight: bold;
    font-size: 1.2rem;
    min-height: 30px;
    margin-top: 10px;
    color: #34495e;
}

/* 모달 */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100;
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
    animation: fadeIn 0.3s;
}

.modal-content {
    background: #fff;
    width: 90%;
    max-width: 400px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    padding: 25px;
    border-radius: 20px;
    position: relative;
}

.close-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #e74c3c;
    color: #fff;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 0 #c0392b;
}

.close-btn:active {
    transform: translateY(4px);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* 상점목록 */
.shop-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-top: 15px;
    overflow-y: auto;
    padding-right: 5px;
}

.shop-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 10px;
    border: 2px solid #ddd;
}

.shop-item .avatar {
    font-size: 2.5rem;
}

.shop-item .info {
    flex: 1;
    text-align: left;
    padding-left: 10px;
}

.btn-buy {
    background: #2ecc71;
    border: none;
    color: white;
    padding: 8px 15px;
    border-radius: 8px;
    font-weight: bold;
    box-shadow: 0 3px 0 #27ae60;
    cursor: pointer;
}

.btn-buy:active {
    transform: translateY(3px);
    box-shadow: 0 0 0 #27ae60;
}

.btn-buy:disabled {
    background: #bdc3c7;
    box-shadow: 0 3px 0 #95a5a6;
    cursor: not-allowed;
}

/* 커스텀 스크롤바 (상점 및 모달용) */
.shop-grid::-webkit-scrollbar {
    width: 8px;
}

.shop-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.shop-grid::-webkit-scrollbar-thumb {
    background: #bdc3c7;
    border-radius: 4px;
}

.shop-grid::-webkit-scrollbar-thumb:hover {
    background: #95a5a6;
}