/* ========================================
   한글이랑 놀자 - 체계적 학습 앱 (개선 버전)
   ======================================== */

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

html, body {
    font-family: 'Segoe UI', 'Malgun Gothic', sans-serif;
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    font-size: clamp(14px, 2vmin, 18px);
}

/* 화면 기본 */
.screen {
    display: none;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    padding: 2vmin;
    overflow: hidden;
}

.screen.active {
    display: flex;
}

/* 상단 바 */
.screen-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    margin-bottom: 1vmin;
}

.back-btn {
    background: rgba(255,255,255,0.9);
    border: none;
    padding: 1.5vmin 3vmin;
    border-radius: 20px;
    font-size: clamp(0.9rem, 2vmin, 1.1rem);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.stars-display {
    background: rgba(255,255,255,0.9);
    padding: 1.5vmin 3vmin;
    border-radius: 20px;
    font-size: clamp(0.9rem, 2vmin, 1.1rem);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* 화면 헤더 */
.screen-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2vmin;
    flex-shrink: 0;
    margin-bottom: 2vmin;
}

.screen-header h2 {
    color: #5a4a78;
    font-size: clamp(1.3rem, 4vmin, 2rem);
}

/* 캐릭터 크기 */
.character-large {
    width: clamp(80px, 12vmin, 130px);
    height: clamp(80px, 12vmin, 130px);
}

.character-medium {
    width: clamp(60px, 10vmin, 100px);
    height: clamp(60px, 10vmin, 100px);
}

.character-small {
    width: clamp(45px, 7vmin, 70px);
    height: clamp(45px, 7vmin, 70px);
}

/* 애니메이션 */
.bounce {
    animation: bounce 2s ease-in-out infinite;
}
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.float {
    animation: float 3s ease-in-out infinite;
}
@keyframes float {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50% { transform: translateY(-6px) rotate(2deg); }
}

.jump {
    animation: jump 0.5s ease-in-out infinite;
}
@keyframes jump {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-15px) scale(1.1); }
}

/* 말풍선 */
.speech-bubble {
    background: white;
    padding: 2vmin 3vmin;
    border-radius: 18px;
    font-size: clamp(0.9rem, 2.2vmin, 1.2rem);
    color: #5a4a78;
    box-shadow: 0 3px 12px rgba(0,0,0,0.1);
    line-height: 1.5;
    position: relative;
}

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

/* ========================================
   홈 화면
   ======================================== */
.sound-control {
    position: absolute;
    top: 2vmin;
    right: 2vmin;
}

.bgm-btn {
    width: clamp(45px, 7vmin, 55px);
    height: clamp(45px, 7vmin, 55px);
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.9);
    font-size: clamp(1.3rem, 3vmin, 1.8rem);
    cursor: pointer;
    box-shadow: 0 3px 12px rgba(0,0,0,0.15);
}

#screen-home {
    align-items: center;
    justify-content: space-evenly;
    position: relative;
}

.home-header {
    display: flex;
    align-items: center;
    gap: 3vmin;
}

.app-title {
    font-size: clamp(1.5rem, 4.5vmin, 2.5rem);
    color: #5a4a78;
    text-shadow: 2px 2px 4px rgba(255,255,255,0.5);
}

/* 2x3 그리드 홈 메뉴 */
.home-menu-3col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5vmin;
    width: 100%;
    max-width: 550px;
}

/* 기존 2x2 폴백 */
.home-menu {
    width: 100%;
    max-width: 550px;
}

.menu-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2.5vmin 1.5vmin;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    transition: transform 0.2s;
}

.menu-btn:active {
    transform: scale(0.95);
}

.btn-learn { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; }
.btn-game { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); color: white; }
.btn-chat { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); color: white; }
.btn-awards { background: linear-gradient(135deg, #f6d365 0%, #fda085 100%); color: white; }
.btn-adventure { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); color: white; }
.btn-review { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); color: white; }

.menu-icon {
    font-size: clamp(1.8rem, 4.5vmin, 2.8rem);
}

.menu-text {
    font-size: clamp(0.75rem, 2vmin, 1.1rem);
    font-weight: bold;
    margin-top: 0.5vmin;
}

.menu-progress, .menu-stars {
    font-size: clamp(0.7rem, 1.5vmin, 0.9rem);
    opacity: 0.9;
    margin-top: 0.3vmin;
}

/* ========================================
   이름 입력 모달
   ======================================== */
.name-modal-content {
    text-align: center;
}

.name-modal-dino {
    font-size: clamp(4rem, 12vmin, 7rem);
    animation: bounce 2s ease-in-out infinite;
}

.name-modal-content h3 {
    font-size: clamp(1.3rem, 3.5vmin, 1.8rem);
    color: #5a4a78;
    margin: 2vmin 0;
}

.name-modal-content input {
    text-align: center;
    font-size: clamp(1.2rem, 3vmin, 1.5rem) !important;
}

/* ========================================
   학습 메뉴 (레벨 선택)
   ======================================== */
.level-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5vmin;
    padding: 1vmin;
}

.level-btn {
    display: flex;
    align-items: center;
    padding: 2.5vmin 3vmin;
    border: none;
    border-radius: 18px;
    background: white;
    cursor: pointer;
    box-shadow: 0 3px 12px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.level-btn:active {
    transform: scale(0.98);
}

.level-btn.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.level-btn.completed {
    background: linear-gradient(135deg, #d4fc79 0%, #96e6a1 100%);
}

.level-number {
    width: clamp(35px, 6vmin, 50px);
    height: clamp(35px, 6vmin, 50px);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1rem, 2.5vmin, 1.3rem);
    font-weight: bold;
    margin-right: 3vmin;
}

.level-info {
    flex: 1;
    text-align: left;
}

.level-title {
    font-size: clamp(1rem, 2.5vmin, 1.3rem);
    color: #5a4a78;
    font-weight: bold;
}

.level-desc {
    font-size: clamp(0.8rem, 1.8vmin, 1rem);
    color: #888;
    margin-top: 0.3vmin;
}

.level-progress {
    font-size: clamp(0.9rem, 2vmin, 1.1rem);
    color: #667eea;
}

/* ========================================
   글자 목록
   ======================================== */
.letter-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(55px, 10vmin, 80px), 1fr));
    gap: 1.5vmin;
    align-content: center;
    padding: 1vmin;
}

.letter-btn {
    aspect-ratio: 1;
    border: none;
    border-radius: 15px;
    font-size: clamp(1.8rem, 5vmin, 2.8rem);
    cursor: pointer;
    background: white;
    color: #5a4a78;
    box-shadow: 0 3px 12px rgba(0,0,0,0.1);
    transition: transform 0.2s;
    position: relative;
}

.letter-btn:active {
    transform: scale(0.9);
}

.letter-btn.completed::after {
    content: '⭐';
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: clamp(0.8rem, 2vmin, 1rem);
}

.letter-btn.current {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* ========================================
   글자 학습
   ======================================== */
.learn-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.learn-step {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    flex: 1;
    padding: 2vmin;
}

.learn-step.active {
    display: flex;
}

.lesson-progress {
    background: rgba(255,255,255,0.9);
    padding: 1vmin 2vmin;
    border-radius: 15px;
    font-size: clamp(0.9rem, 2vmin, 1.1rem);
    color: #5a4a78;
}

.big-letter {
    font-size: clamp(6rem, 20vmin, 12rem);
    color: #5a4a78;
    background: white;
    width: clamp(120px, 28vmin, 200px);
    height: clamp(120px, 28vmin, 200px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 25px;
    box-shadow: 0 6px 25px rgba(0,0,0,0.15);
}

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

.letter-name {
    font-size: clamp(1.5rem, 4vmin, 2rem);
    color: #666;
}

.sound-btn {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: white;
    border: none;
    padding: 2vmin 5vmin;
    border-radius: 25px;
    font-size: clamp(1rem, 2.5vmin, 1.3rem);
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(67, 233, 123, 0.4);
    transition: opacity 0.2s;
}

.sound-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

.example-word {
    display: flex;
    align-items: center;
    gap: 2vmin;
    background: rgba(255,255,255,0.8);
    padding: 2vmin 4vmin;
    border-radius: 20px;
}

.example-word span:first-child {
    font-size: clamp(2rem, 5vmin, 3rem);
}

.example-word span:last-child {
    font-size: clamp(1.3rem, 3vmin, 1.8rem);
    color: #5a4a78;
}

/* 발음 팁 */
.letter-tip {
    display: block;
    font-size: clamp(0.9rem, 2.2vmin, 1.1rem);
    color: #888;
    margin-top: 0.5vmin;
}

/* 가획 원리 표시 */
.learn-from {
    display: flex;
    align-items: center;
    gap: 1.5vmin;
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    padding: 1.5vmin 3vmin;
    border-radius: 15px;
    font-size: clamp(1.5rem, 4vmin, 2rem);
}

.from-letter {
    color: #888;
}

.to-letter {
    color: #5a4a78;
    font-weight: bold;
}

/* 테마 단어 표시 */
.theme-word-display {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    padding: 2vmin 3vmin;
    border-radius: 18px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.theme-word-display .theme-emoji {
    font-size: clamp(2rem, 5vmin, 3rem);
}

.theme-word-display .theme-text {
    font-size: clamp(1rem, 2.5vmin, 1.3rem);
    color: #2e7d32;
    font-weight: bold;
    margin: 0.5vmin 0;
}

.theme-word-display .theme-sentence {
    font-size: clamp(0.85rem, 2vmin, 1rem);
    color: #555;
}

/* 글자 조합 화면 */
.combine-display {
    display: flex;
    align-items: center;
    gap: 2vmin;
    background: white;
    padding: 3vmin 5vmin;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.combine-part {
    font-size: clamp(3rem, 10vmin, 5rem);
    color: #667eea;
}

.combine-plus, .combine-equals {
    font-size: clamp(2rem, 6vmin, 3rem);
    color: #888;
}

.combine-result {
    font-size: clamp(3rem, 10vmin, 5rem);
    color: #5a4a78;
    font-weight: bold;
}

.example-after {
    display: flex;
    align-items: center;
    gap: 2vmin;
    background: linear-gradient(135deg, #d4fc79 0%, #96e6a1 100%);
    padding: 2vmin 4vmin;
    border-radius: 20px;
    margin-top: 2vmin;
    font-size: clamp(1.5rem, 4vmin, 2rem);
}

/* 받침 화면 */
.batchim-display {
    text-align: center;
}

.batchim-char {
    font-size: clamp(5rem, 15vmin, 8rem);
    color: #5a4a78;
    background: white;
    padding: 3vmin 5vmin;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    display: inline-block;
}

.batchim-parts {
    font-size: clamp(1.3rem, 3.5vmin, 1.8rem);
    color: #667eea;
    margin-top: 2vmin;
}

.example-word-display {
    display: flex;
    align-items: center;
    gap: 2vmin;
    background: rgba(255,255,255,0.9);
    padding: 2vmin 4vmin;
    border-radius: 20px;
    font-size: clamp(1.5rem, 4vmin, 2rem);
}

.next-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 2.5vmin 6vmin;
    border-radius: 25px;
    font-size: clamp(1.1rem, 2.8vmin, 1.4rem);
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* 따라쓰기 */
.practice-guide {
    background: white;
    padding: 3vmin;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.guide-letter {
    font-size: clamp(4rem, 12vmin, 7rem);
    color: #ddd;
}

.canvas-area {
    position: relative;
}

#write-canvas {
    background: white;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    touch-action: none;
}

.canvas-buttons {
    position: absolute;
    bottom: 10px;
    right: 10px;
}

.clear-btn {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 1.5vmin 3vmin;
    border-radius: 15px;
    font-size: clamp(0.8rem, 2vmin, 1rem);
    cursor: pointer;
}

/* 퀴즈 */
.quiz-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2vmin;
    width: 100%;
}

.quiz-question {
    font-size: clamp(1.2rem, 3vmin, 1.6rem);
    color: #5a4a78;
    text-align: center;
}

.quiz-sound-btn {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: white;
    border: none;
    padding: 2vmin 4vmin;
    border-radius: 20px;
    font-size: clamp(1rem, 2.5vmin, 1.2rem);
    cursor: pointer;
}

.quiz-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2vmin;
    width: 100%;
    max-width: 400px;
}

.quiz-option {
    padding: 3vmin;
    border: 3px solid #e0e0e0;
    border-radius: 18px;
    font-size: clamp(2rem, 6vmin, 3rem);
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.quiz-option:active {
    transform: scale(0.95);
}

.quiz-option.correct {
    background: #4ade80;
    border-color: #22c55e;
    color: white;
}

.quiz-option.wrong {
    background: #f87171;
    border-color: #ef4444;
    color: white;
}

.quiz-result {
    font-size: clamp(1.2rem, 3vmin, 1.5rem);
    min-height: 2em;
    color: #5a4a78;
}

/* 완료 */
.complete-message {
    text-align: center;
    color: #5a4a78;
}

.stars-earned {
    font-size: clamp(3rem, 8vmin, 5rem);
    animation: sparkle 1s ease infinite;
}

@keyframes sparkle {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.complete-message p {
    font-size: clamp(1.3rem, 3.5vmin, 1.8rem);
}

.complete-letter {
    font-size: clamp(3rem, 8vmin, 5rem);
    font-weight: bold;
}

/* ========================================
   게임 메뉴
   ======================================== */
.game-menu-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2vmin;
    padding: 1vmin;
    justify-content: center;
}

.game-menu-btn {
    display: flex;
    align-items: center;
    padding: 3vmin;
    border: none;
    border-radius: 20px;
    background: white;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.game-menu-btn:active {
    transform: scale(0.98);
}

.game-menu-icon {
    font-size: clamp(2rem, 5vmin, 3rem);
    margin-right: 3vmin;
}

.game-menu-text {
    font-size: clamp(1.1rem, 2.8vmin, 1.4rem);
    color: #5a4a78;
    font-weight: bold;
}

.game-menu-desc {
    font-size: clamp(0.8rem, 1.8vmin, 1rem);
    color: #888;
    margin-left: auto;
}

/* ========================================
   게임 화면
   ======================================== */
.game-score {
    background: rgba(255,255,255,0.9);
    padding: 1.5vmin 3vmin;
    border-radius: 20px;
    font-size: clamp(1rem, 2.5vmin, 1.2rem);
    color: #5a4a78;
}

.game-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3vmin;
}

.game-prompt {
    font-size: clamp(1.2rem, 3vmin, 1.6rem);
    color: #5a4a78;
    text-align: center;
}

.game-target {
    font-size: clamp(5rem, 15vmin, 9rem);
    color: #5a4a78;
    background: white;
    padding: 3vmin 5vmin;
    border-radius: 25px;
    box-shadow: 0 6px 25px rgba(0,0,0,0.15);
}

.game-choices {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2vmin;
    width: 100%;
    max-width: 400px;
}

.game-choice {
    padding: 3vmin;
    border: 3px solid #e0e0e0;
    border-radius: 18px;
    font-size: clamp(2rem, 6vmin, 3rem);
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.game-choice:active {
    transform: scale(0.95);
}

.game-choice.correct {
    background: #4ade80;
    border-color: #22c55e;
    color: white;
}

.game-choice.wrong {
    background: #f87171;
    border-color: #ef4444;
    color: white;
}

.game-choice.listening,
.quiz-option.listening {
    background: linear-gradient(135deg, #feca57, #ff9ff3);
    border-color: #ffc107;
    transform: scale(1.05);
    animation: pulse-listen 0.8s infinite;
    box-shadow: 0 0 20px rgba(255, 193, 7, 0.5);
}

@keyframes pulse-listen {
    0%, 100% { transform: scale(1.05); }
    50% { transform: scale(1.1); }
}

/* ========================================
   공룡섬 게임 스타일
   ======================================== */
#adventure-canvas {
    border: 3px solid #8B4513;
    border-radius: 15px;
    background: #87CEEB;
    touch-action: manipulation;
    max-width: 100%;
    height: auto;
}

#adventure-ui {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1vmin 0;
    font-weight: bold;
    font-size: clamp(0.9rem, 2.5vmin, 1.2rem);
}

#adventure-progress, #adventure-stars {
    background: rgba(255,255,255,0.9);
    padding: 1vmin 2vmin;
    border-radius: 10px;
    border: 2px solid #ddd;
}

#adventure-hint {
    background: rgba(255, 193, 7, 0.9);
    color: #333;
    padding: 1vmin 2vmin;
    border-radius: 10px;
    font-size: clamp(0.8rem, 2vmin, 1rem);
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-5px); }
    60% { transform: translateY(-3px); }
}

.quiz-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.quiz-content {
    background: white;
    padding: 4vmin;
    border-radius: 20px;
    text-align: center;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
}

.quiz-content p {
    font-size: clamp(1.2rem, 3vmin, 1.6rem);
    margin-bottom: 3vmin;
    font-weight: bold;
    color: #333;
}

.quiz-choice-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 2.5vmin 4vmin;
    margin: 1vmin;
    border-radius: 15px;
    font-size: clamp(1.5rem, 4vmin, 2rem);
    cursor: pointer;
    transition: all 0.3s;
    min-width: 80px;
}

.quiz-choice-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

.quiz-choice-btn.correct {
    background: linear-gradient(135deg, #4ade80, #22c55e);
}

.quiz-choice-btn.wrong {
    background: linear-gradient(135deg, #f87171, #ef4444);
}

.quiz-choice-btn.listening {
    background: linear-gradient(135deg, #feca57, #ff9ff3);
    transform: scale(1.1);
    animation: pulse-listen 0.8s infinite;
}

.game-feedback {
    font-size: clamp(1.2rem, 3vmin, 1.5rem);
    min-height: 2em;
}

.game-next-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 2vmin 5vmin;
    border-radius: 25px;
    font-size: clamp(1rem, 2.5vmin, 1.2rem);
    cursor: pointer;
    display: none;
}

/* ========================================
   대화 화면 (개편)
   ======================================== */
#screen-chat {
    gap: 1vmin;
}

.settings-btn {
    background: rgba(255,255,255,0.9);
    border: none;
    padding: 1.5vmin 2.5vmin;
    border-radius: 15px;
    font-size: clamp(1rem, 2.5vmin, 1.2rem);
    cursor: pointer;
}

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-character-area {
    display: flex;
    align-items: center;
    gap: 2vmin;
    padding: 2vmin;
    flex-shrink: 0;
}

.chat-bubble {
    background: white;
    padding: 2vmin 3vmin;
    border-radius: 18px;
    border-top-left-radius: 5px;
    font-size: clamp(0.95rem, 2.3vmin, 1.2rem);
    color: #5a4a78;
    box-shadow: 0 3px 12px rgba(0,0,0,0.1);
    line-height: 1.5;
    max-width: 75%;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1vmin 2vmin;
    display: flex;
    flex-direction: column;
    gap: 1.5vmin;
}

.message {
    padding: 2vmin 3vmin;
    border-radius: 18px;
    max-width: 80%;
    font-size: clamp(0.95rem, 2.3vmin, 1.15rem);
    line-height: 1.4;
}

.message.user {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 5px;
}

.message.assistant {
    background: white;
    color: #5a4a78;
    align-self: flex-start;
    border-bottom-left-radius: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* 선택지 버튼 */
.chat-quick-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5vmin;
    padding: 1.5vmin;
    justify-content: center;
    flex-shrink: 0;
}

.chat-quick-btn {
    padding: 2vmin 3vmin;
    border: 2px solid #667eea;
    border-radius: 25px;
    background: white;
    color: #5a4a78;
    font-size: clamp(0.85rem, 2vmin, 1.05rem);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.chat-quick-btn:active {
    transform: scale(0.95);
    background: #667eea;
    color: white;
}

/* 대화 입력 영역 (개편) */
.chat-input-area {
    display: flex;
    gap: 1.5vmin;
    padding: 1.5vmin;
    background: rgba(255,255,255,0.6);
    border-radius: 25px;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
}

.mic-btn-large {
    width: clamp(60px, 10vmin, 75px);
    height: clamp(60px, 10vmin, 75px);
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    font-size: clamp(1.8rem, 4.5vmin, 2.5rem);
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(67, 233, 123, 0.4);
    transition: transform 0.2s;
}

.mic-btn-large:active {
    transform: scale(0.9);
}

.mic-btn-large.recording {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    animation: pulse 1s infinite;
}

.keyboard-toggle-btn {
    width: clamp(45px, 7vmin, 55px);
    height: clamp(45px, 7vmin, 55px);
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.9);
    font-size: clamp(1.2rem, 3vmin, 1.5rem);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.chat-text-input {
    display: flex;
    gap: 1.5vmin;
    flex: 1;
    align-items: center;
}

.chat-text-input.hidden {
    display: none;
}

#chat-input {
    flex: 1;
    border: none;
    padding: 2vmin 3vmin;
    border-radius: 20px;
    font-size: clamp(0.95rem, 2.3vmin, 1.15rem);
    outline: none;
}

.mic-btn {
    width: clamp(45px, 7vmin, 55px);
    height: clamp(45px, 7vmin, 55px);
    border-radius: 50%;
    border: none;
    background: #43e97b;
    font-size: clamp(1.2rem, 3vmin, 1.5rem);
    cursor: pointer;
}

.mic-btn.recording {
    background: #ff6b6b;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.send-btn {
    padding: 2vmin 3.5vmin;
    border-radius: 20px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: clamp(0.9rem, 2vmin, 1.1rem);
    font-weight: bold;
    cursor: pointer;
}

/* ========================================
   공룡섬 모험
   ======================================== */
.adventure-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2vmin;
    overflow-y: auto;
    padding: 2vmin;
}

.adventure-story {
    background: white;
    padding: 3vmin;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 3px 12px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 500px;
}

.adventure-story-emoji {
    font-size: clamp(3rem, 8vmin, 5rem);
}

.adventure-story-text {
    font-size: clamp(1rem, 2.5vmin, 1.3rem);
    color: #5a4a78;
    line-height: 1.6;
    margin-top: 1.5vmin;
}

.adventure-stages {
    display: flex;
    flex-direction: column;
    gap: 2vmin;
    width: 100%;
    max-width: 500px;
}

.adventure-stage-btn {
    display: flex;
    align-items: center;
    padding: 3vmin;
    border: none;
    border-radius: 20px;
    background: white;
    cursor: pointer;
    box-shadow: 0 3px 12px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.adventure-stage-btn:active {
    transform: scale(0.98);
}

.adventure-stage-btn.locked {
    opacity: 0.45;
    cursor: not-allowed;
}

.adventure-stage-btn.completed {
    background: linear-gradient(135deg, #d4fc79 0%, #96e6a1 100%);
}

.stage-icon {
    font-size: clamp(2.5rem, 6vmin, 3.5rem);
    margin-right: 3vmin;
}

.stage-info {
    flex: 1;
    text-align: left;
}

.stage-name {
    font-size: clamp(1rem, 2.5vmin, 1.3rem);
    color: #5a4a78;
    font-weight: bold;
}

.stage-desc {
    font-size: clamp(0.8rem, 1.8vmin, 1rem);
    color: #888;
    margin-top: 0.3vmin;
}

.stage-status {
    font-size: clamp(1.2rem, 3vmin, 1.5rem);
}

/* ========================================
   상장 화면
   ======================================== */
.awards-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3vmin;
    overflow-y: auto;
    padding: 2vmin;
}

.total-stars {
    display: flex;
    align-items: center;
    gap: 1vmin;
    background: white;
    padding: 3vmin 5vmin;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.big-star {
    font-size: clamp(2.5rem, 6vmin, 4rem);
}

.star-count {
    font-size: clamp(2rem, 5vmin, 3rem);
    color: #5a4a78;
    font-weight: bold;
}

.star-label {
    font-size: clamp(1.2rem, 3vmin, 1.5rem);
    color: #888;
}

.awards-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(100px, 20vmin, 150px), 1fr));
    gap: 2vmin;
    width: 100%;
}

.award-item {
    background: white;
    padding: 2vmin;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 3px 12px rgba(0,0,0,0.1);
}

.award-item.locked {
    opacity: 0.4;
}

.award-icon {
    font-size: clamp(2rem, 5vmin, 3rem);
}

.award-name {
    font-size: clamp(0.8rem, 1.8vmin, 1rem);
    color: #5a4a78;
    margin-top: 1vmin;
}

/* ========================================
   오버레이 / 모달
   ======================================== */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.overlay.hidden {
    display: none;
}

.celebration-content {
    background: white;
    padding: 5vmin;
    border-radius: 30px;
    text-align: center;
    animation: popIn 0.5s ease;
}

@keyframes popIn {
    0% { transform: scale(0); }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.celebration-stars {
    font-size: clamp(2rem, 5vmin, 3rem);
    margin: 2vmin 0;
}

.celebration-text {
    font-size: clamp(1.5rem, 4vmin, 2.2rem);
    color: #5a4a78;
    font-weight: bold;
}

.modal-content {
    background: white;
    padding: 4vmin;
    border-radius: 25px;
    width: 90%;
    max-width: 350px;
    text-align: center;
}

.modal-content h3 {
    color: #5a4a78;
    margin-bottom: 3vmin;
    font-size: clamp(1.1rem, 2.8vmin, 1.4rem);
}

.modal-content input {
    width: 100%;
    padding: 2vmin;
    border: 2px solid #e0e0e0;
    border-radius: 15px;
    font-size: clamp(0.9rem, 2vmin, 1.1rem);
    margin-bottom: 3vmin;
}

.modal-buttons {
    display: flex;
    gap: 2vmin;
    justify-content: center;
}

.modal-buttons button {
    padding: 2vmin 4vmin;
    border-radius: 18px;
    border: none;
    font-size: clamp(0.9rem, 2vmin, 1.1rem);
    cursor: pointer;
}

.modal-buttons button:first-child {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.modal-buttons button:last-child {
    background: #e0e0e0;
    color: #666;
}

/* ========================================
   가로모드
   ======================================== */
@media (orientation: landscape) {
    .home-menu-3col {
        grid-template-columns: repeat(3, 1fr);
    }

    .game-choices, .quiz-options {
        grid-template-columns: repeat(4, 1fr);
    }

    .learn-step {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 3vmin;
    }
}

/* 세로모드 작은 화면 */
@media (max-width: 400px) {
    .home-menu-3col {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========================================
   부모 대시보드 스타일
   ======================================== */
.parent-settings-btn {
    position: absolute;
    top: 2vmin;
    right: 6vmin;
    background: rgba(255,255,255,0.8);
    border: none;
    padding: 2vmin;
    border-radius: 50%;
    font-size: 1.5rem;
}

.parent-dashboard {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3vmin;
    overflow-y: auto;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2vmin;
}

.stat-card {
    background: rgba(255,255,255,0.9);
    border-radius: 15px;
    padding: 3vmin;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: 1vmin;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 0.5vmin;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
}

.progress-charts {
    background: rgba(255,255,255,0.9);
    border-radius: 15px;
    padding: 3vmin;
}

.progress-charts h3 {
    margin-bottom: 2vmin;
    color: #667eea;
}

.progress-item {
    display: flex;
    align-items: center;
    gap: 2vmin;
    margin-bottom: 2vmin;
}

.progress-item span:first-child {
    min-width: 5rem;
    font-size: 0.9rem;
}

.progress-bar {
    flex: 1;
    height: 1rem;
    background: #e0e0e0;
    border-radius: 0.5rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 0.5rem;
    transition: width 0.3s ease;
}

.progress-item span:last-child {
    min-width: 3rem;
    font-size: 0.9rem;
    font-weight: bold;
}

.dashboard-actions {
    text-align: center;
}

.reset-btn, .danger-btn {
    background: #ff6b6b !important;
    color: white !important;
    border: none;
    padding: 2vmin 4vmin;
    border-radius: 15px;
    font-size: 1rem;
    cursor: pointer;
}

.reset-btn:hover, .danger-btn:hover {
    background: #ff5252 !important;
}

/* ========================================
   캐릭터 꾸미기 스타일
   ======================================== */
.character-showcase {
    text-align: center;
    margin-bottom: 3vmin;
}

.character-decorated {
    width: 8rem;
    height: 8rem;
    margin-bottom: 1vmin;
}

.character-name {
    font-size: 1.2rem;
    font-weight: bold;
    color: #667eea;
}

.accessories-section {
    background: rgba(255,255,255,0.9);
    border-radius: 15px;
    padding: 3vmin;
    margin-bottom: 3vmin;
}

.accessories-section h3 {
    margin-bottom: 2vmin;
    color: #667eea;
}

.accessories-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2vmin;
}

.accessory-item {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 2vmin;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.accessory-item.unlocked {
    border-color: #667eea;
    cursor: pointer;
}

.accessory-item.unlocked:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.accessory-item.selected {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border-color: #667eea;
}

.accessory-item.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.accessory-icon {
    font-size: 2rem;
    margin-bottom: 1vmin;
}

.accessory-name {
    font-weight: bold;
    margin-bottom: 0.5vmin;
}

.accessory-requirement {
    font-size: 0.8rem;
    color: #666;
}

.accessory-item.selected .accessory-requirement {
    color: rgba(255,255,255,0.8);
}

/* ========================================
   획순 애니메이션 스타일
   ======================================== */
.replay-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 1.5vmin 3vmin;
    border-radius: 10px;
    font-size: clamp(0.9rem, 2vmin, 1.1rem);
    cursor: pointer;
    margin-left: 1vmin;
}

.replay-btn:hover {
    background: #5a67d8;
}

/* 캔버스 버튼들 정렬 */
.canvas-buttons {
    display: flex;
    justify-content: center;
    gap: 2vmin;
    margin-top: 2vmin;
}

/* ========================================
   SVG 아이콘 스타일
   ======================================== */
.menu-icon-svg {
    width: clamp(40px, 8vmin, 60px);
    height: clamp(40px, 8vmin, 60px);
    margin-bottom: 1vmin;
}

.app-logo-svg {
    width: clamp(35px, 6vmin, 50px);
    height: clamp(35px, 6vmin, 50px);
    vertical-align: middle;
    margin-right: 1vmin;
}

.name-modal-dino {
    width: clamp(80px, 15vmin, 120px);
    height: clamp(80px, 15vmin, 120px);
    margin: 0 auto 2vmin auto;
    display: block;
}

/* 캐릭터 변경 - 또리(공룡) 전용 */
.character-decorated {
    width: clamp(100px, 15vmin, 140px);
    height: clamp(100px, 15vmin, 140px);
}

/* 스테이지 아이콘 스타일 */
.stage-icon-svg {
    width: clamp(50px, 10vmin, 70px);
    height: clamp(50px, 10vmin, 70px);
}

/* 모험 스토리 캐릭터들 */
.adventure-story-chars {
    display: flex;
    justify-content: center;
    gap: 1vmin;
    margin-bottom: 2vmin;
}

.adventure-char-svg {
    width: clamp(30px, 6vmin, 45px);
    height: clamp(30px, 6vmin, 45px);
    animation: float 3s ease-in-out infinite;
}

.adventure-char-svg:nth-child(2) {
    animation-delay: -0.5s;
}

.adventure-char-svg:nth-child(3) {
    animation-delay: -1s;
}

.adventure-char-svg:nth-child(4) {
    animation-delay: -1.5s;
}

/* 보상 아이템 아이콘 스타일 */
.reward-icon-svg {
    width: clamp(40px, 8vmin, 55px);
    height: clamp(40px, 8vmin, 55px);
}

/* 게임 메뉴 아이콘 */
.game-menu-icon-svg {
    width: clamp(45px, 9vmin, 65px);
    height: clamp(45px, 9vmin, 65px);
    margin-bottom: 1vmin;
}

/* 애니메이션 유지 */
.menu-icon-svg, .character-decorated, .name-modal-dino {
    transition: transform 0.2s ease;
}

.menu-icon-svg:hover {
    transform: scale(1.1);
}

/* 색상 테마에 맞는 SVG 아이콘 필터 */
.btn-learn .menu-icon-svg {
    filter: brightness(1.2);
}

.btn-game .menu-icon-svg {
    filter: brightness(1.2);
}

.btn-chat .menu-icon-svg {
    filter: brightness(1.2);
}

.btn-adventure .menu-icon-svg {
    filter: brightness(1.2);
}

.btn-review .menu-icon-svg {
    filter: brightness(1.2);
}

.btn-awards .menu-icon-svg {
    filter: brightness(1.2);
}

/* ========================================
   반응형 개선
   ======================================== */
@media (max-width: 600px) {
    .dashboard-stats {
        grid-template-columns: 1fr;
    }
    
    .accessories-grid {
        grid-template-columns: 1fr;
    }
    
    .progress-item {
        flex-direction: column;
        align-items: stretch;
        gap: 1vmin;
    }
    
    .progress-item span:first-child {
        min-width: auto;
    }
    
    .progress-item span:last-child {
        min-width: auto;
        text-align: center;
    }
    
    /* 모바일에서 SVG 크기 조정 */
    .menu-icon-svg {
        width: clamp(35px, 7vmin, 50px);
        height: clamp(35px, 7vmin, 50px);
    }
    
    .app-logo-svg {
        width: clamp(30px, 5vmin, 40px);
        height: clamp(30px, 5vmin, 40px);
    }
}

/* ========================================
   보상 애니메이션
   ======================================== */
.reward-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    pointer-events: none;
}

.reward-overlay.hidden {
    display: none;
}

.reward-content {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

/* 또리 춤추기 애니메이션 */
.reward-dance .reward-dino {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    animation: dance 0.5s ease-in-out infinite alternate;
}

.reward-dance .reward-star {
    position: absolute;
    font-size: 30px;
    animation: starSpin 2s linear infinite;
}

@keyframes dance {
    0% { transform: translate(-50%, -50%) rotate(-5deg) scale(0.9); }
    100% { transform: translate(-50%, -50%) rotate(5deg) scale(1.1); }
}

@keyframes starSpin {
    0% { transform: rotate(0deg) translateX(60px) rotate(0deg); }
    100% { transform: rotate(360deg) translateX(60px) rotate(-360deg); }
}

/* 로켓 발사 애니메이션 */
.reward-rocket .reward-dino {
    position: absolute;
    left: 50%;
    bottom: -120px;
    width: 80px;
    height: 80px;
    animation: rocketLaunch 3s ease-in-out forwards;
}

.reward-rocket .reward-trail {
    position: absolute;
    left: 50%;
    bottom: -60px;
    width: 20px;
    height: 60px;
    background: linear-gradient(to top, orange, red, transparent);
    border-radius: 10px;
    transform: translateX(-50%);
    animation: rocketTrail 3s ease-in-out forwards;
}

@keyframes rocketLaunch {
    0% { transform: translate(-50%, 0) rotate(0deg); bottom: 20%; }
    100% { transform: translate(-50%, 0) rotate(15deg); bottom: 120%; }
}

@keyframes rocketTrail {
    0% { opacity: 1; height: 60px; }
    100% { opacity: 0; height: 120px; }
}

/* 무지개 애니메이션 */
.reward-rainbow .rainbow {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 150px;
    border-radius: 300px 300px 0 0;
    border: 20px solid;
    border-color: red orange yellow green blue indigo violet;
    border-bottom: none;
    animation: rainbowAppear 2s ease-in-out forwards;
    opacity: 0;
}

.reward-rainbow .reward-dino {
    position: absolute;
    left: 50%;
    bottom: 30%;
    width: 100px;
    height: 100px;
    transform: translateX(-50%);
    animation: celebrate 1s ease-in-out infinite alternate;
}

@keyframes rainbowAppear {
    0% { opacity: 0; transform: translateX(-50%) scale(0); }
    100% { opacity: 1; transform: translateX(-50%) scale(1); }
}

@keyframes celebrate {
    0% { transform: translateX(-50%) scale(0.9); }
    100% { transform: translateX(-50%) scale(1.1); }
}

/* 파티 폭죽 애니메이션 */
.reward-firework .confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    animation: confettiFall 3s ease-out forwards;
}

.reward-firework .reward-dino {
    position: absolute;
    left: 50%;
    bottom: 30%;
    width: 100px;
    height: 100px;
    transform: translateX(-50%);
    animation: clap 0.5s ease-in-out infinite;
}

@keyframes confettiFall {
    0% {
        opacity: 1;
        transform: translateY(-100px) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(calc(100vh + 100px)) rotate(720deg);
    }
}

@keyframes clap {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.05); }
}

/* 보물상자 애니메이션 */
.reward-treasure .treasure-box {
    position: absolute;
    left: 50%;
    top: 40%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 60px;
    background: #8B4513;
    border-radius: 10px;
    animation: treasureShake 0.5s ease-in-out 2s forwards;
}

.reward-treasure .treasure-lid {
    position: absolute;
    top: -10px;
    left: 0;
    width: 80px;
    height: 20px;
    background: #CD853F;
    border-radius: 10px 10px 5px 5px;
    transform-origin: 0 bottom;
    animation: treasureOpen 1s ease-out 2.5s forwards;
}

.reward-treasure .gold-coin {
    position: absolute;
    width: 15px;
    height: 15px;
    background: #FFD700;
    border-radius: 50%;
    opacity: 0;
    animation: coinExplode 2s ease-out 2.5s forwards;
}

.reward-treasure .reward-dino {
    position: absolute;
    left: 50%;
    bottom: 20%;
    width: 90px;
    height: 90px;
    transform: translateX(-50%);
    animation: excited 0.3s ease-in-out infinite;
}

@keyframes treasureShake {
    0%, 100% { transform: translate(-50%, -50%); }
    25% { transform: translate(-52%, -50%); }
    75% { transform: translate(-48%, -50%); }
}

@keyframes treasureOpen {
    0% { transform: rotateX(0deg); }
    100% { transform: rotateX(-90deg); }
}

@keyframes coinExplode {
    0% {
        opacity: 0;
        transform: translateY(0) scale(0);
    }
    50% {
        opacity: 1;
        transform: translateY(-50px) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-100px) scale(0.5);
    }
}

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

/* ========================================
   새로운 미니게임 스타일 (풍선, 두더지, 낚시)
   ======================================== */

/* 풍선 터뜨리기 게임 */
.balloon-game {
    position: relative;
    width: 100%;
    height: 60vh;
    overflow: hidden;
    background: linear-gradient(to bottom, #87CEEB 0%, #E0F6FF 100%);
    border-radius: 15px;
}

.balloon {
    position: absolute;
    width: 70px;
    height: 90px;
    background: var(--color);
    border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
    animation: float 4s ease-in-out infinite, sway 3s ease-in-out infinite;
    left: var(--x);
    top: var(--y);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    animation-delay: var(--delay);
}

.balloon-letter {
    font-size: 1.8rem;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

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

@keyframes sway {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(15px); }
}

.balloon.pop {
    animation: popAnim 0.4s forwards;
}

@keyframes popAnim {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); }
    100% { transform: scale(0); opacity: 0; }
}

.balloon.shake {
    animation: shakeAnim 0.6s ease-in-out;
}

@keyframes shakeAnim {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

.star-particle {
    position: absolute;
    width: 20px;
    height: 20px;
    font-size: 20px;
    pointer-events: none;
    animation: starExplode 1s ease-out forwards;
}

@keyframes starExplode {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: scale(1.5) rotate(180deg);
        opacity: 0;
    }
}

/* 두더지 잡기 게임 */
.mole-game {
    position: relative;
    width: 100%;
    height: 60vh;
    background: linear-gradient(to bottom, #90EE90 0%, #228B22 100%);
    border-radius: 15px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 2vmin;
    padding: 2vmin;
}

.mole-hole {
    width: 80px;
    height: 40px;
    background: #654321;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    margin: auto;
    box-shadow: inset 0 5px 10px rgba(0,0,0,0.5);
}

.mole-letter {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    font-size: 2em;
    font-weight: bold;
    color: #4A4A4A;
    background: #F4A460;
    padding: 10px;
    border-radius: 10px 10px 0 0;
    transition: transform 0.3s ease;
    cursor: pointer;
    text-align: center;
    min-width: 50px;
    border: 3px solid #D2691E;
}

.mole-letter.up {
    transform: translateX(-50%) translateY(0);
}

.mole-letter.hit {
    animation: hitAnim 0.3s ease;
}

@keyframes hitAnim {
    0% { transform: translateX(-50%) translateY(0) scale(1); }
    50% { transform: translateX(-50%) translateY(-10px) scale(1.2); }
    100% { transform: translateX(-50%) translateY(100%) scale(0.8); }
}

.mole-timer {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    height: 10px;
    background: rgba(255,255,255,0.3);
    border-radius: 5px;
    overflow: hidden;
}

.mole-timer-bar {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #FFC107, #F44336);
    border-radius: 5px;
    transition: width 0.1s linear;
}

/* 낚시 게임 */
.fishing-game {
    position: relative;
    width: 100%;
    height: 60vh;
    overflow: hidden;
    border-radius: 15px;
}

.sea-background {
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, #87CEEB 0%, #4682B4 50%, #191970 100%);
    position: relative;
}

.wave {
    position: absolute;
    bottom: 0;
    width: 120%;
    height: 20%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 120"><path d="M0,60 Q150,10 300,60 T600,60 T900,60 T1200,60 V120 H0 Z" fill="rgba(255,255,255,0.3)"/></svg>') repeat-x;
    animation: waveMove 3s ease-in-out infinite;
}

@keyframes waveMove {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-100px); }
}

.fishing-target {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 3rem;
    background: white;
    padding: 10px 20px;
    border-radius: 15px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.fish {
    position: absolute;
    width: 80px;
    height: 40px;
    background: var(--fish-color);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    cursor: pointer;
    animation: swim var(--swim-duration) linear infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    top: var(--swim-top);
}

.fish::after {
    content: '';
    position: absolute;
    right: -15px;
    width: 0;
    height: 0;
    border-left: 20px solid var(--fish-color);
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
}

@keyframes swim {
    0% { left: -100px; }
    100% { left: calc(100vw + 50px); }
}

.fish.caught {
    animation: fishCaught 1s ease-out forwards;
}

@keyframes fishCaught {
    0% { 
        transform: translateY(0) scale(1); 
        opacity: 1; 
    }
    100% { 
        transform: translateY(-200px) scale(0.8); 
        opacity: 0.7; 
    }
}

.fish.escape {
    animation: fishEscape 0.5s ease-in forwards;
}

@keyframes fishEscape {
    0% { transform: scale(1); }
    100% { transform: scale(0) rotate(180deg); }
}

.fishing-line {
    position: absolute;
    width: 3px;
    background: #8B4513;
    opacity: 0;
    transform-origin: top center;
}

.fishing-line.active {
    opacity: 1;
    animation: castLine 0.8s ease-out forwards;
}

@keyframes castLine {
    0% { height: 0; }
    100% { height: var(--line-length); }
}

/* 게임 결과 화면 */
.game-result-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.game-result-content {
    background: white;
    padding: 4vmin;
    border-radius: 20px;
    text-align: center;
    max-width: 90vw;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.game-result-title {
    font-size: clamp(1.5rem, 5vmin, 2.5rem);
    color: #5a4a78;
    margin-bottom: 2vmin;
}

.game-result-score {
    font-size: clamp(1.2rem, 4vmin, 2rem);
    margin-bottom: 3vmin;
}

.game-result-message {
    font-size: clamp(1rem, 3vmin, 1.5rem);
    margin-bottom: 3vmin;
    color: #666;
}

.game-result-buttons {
    display: flex;
    gap: 2vmin;
    justify-content: center;
    flex-wrap: wrap;
}

.game-result-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 2vmin 4vmin;
    border-radius: 25px;
    font-size: clamp(0.9rem, 3vmin, 1.2rem);
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.game-result-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.game-result-btn.secondary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

/* 또리 캐릭터 애니메이션 */
@keyframes doriWalk {
    0% { 
        left: -100px; 
        transform: translateY(0); 
    }
    50% { 
        left: 10%; 
        transform: translateY(-5px); 
    }
    100% { 
        left: 20px; 
        transform: translateY(0); 
    }
}

.dori-character {
    animation: doriWalk 3s ease-in-out;
}

/* 공룡섬 스토리 화면 스타일 */
.adventure-story-scene {
    padding: 2vmin;
}

.adventure-progress-bar {
    background: rgba(255,255,255,0.9);
    padding: 2vmin;
    border-radius: 15px;
    margin-bottom: 2vmin;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.progress-display {
    font-size: clamp(0.9rem, 3vmin, 1.2rem);
    color: #5a4a78;
    margin-bottom: 1vmin;
}

.adventure-minigame {
    animation: slideInUp 0.5s ease-out;
}

@keyframes slideInUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}
