/* ===== CSS 변수 (테마) ===== */
:root {
    /* 라이트 모드 색상 */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --warning-gradient: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.95);
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --text-accent: #667eea;
    
    --border-color: rgba(226, 232, 240, 0.8);
    --shadow-light: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-medium: 0 8px 30px rgba(0, 0, 0, 0.12);
    --shadow-heavy: 0 15px 50px rgba(0, 0, 0, 0.15);
    
    --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    --error-bg: rgba(239, 68, 68, 0.1);
    --success-bg: rgba(34, 197, 94, 0.1);
    --warning-bg: rgba(245, 158, 11, 0.1);
    --info-bg: rgba(59, 130, 246, 0.1);
    --code-bg: rgba(0, 0, 0, 0.1);
    
    /* 추가된 변수들 */
    --surface-color: #ffffff;
    --card-bg: rgba(255, 255, 255, 0.95);
    --error-color: #f56565;
    --success-color: #48bb78;
    --info-color: #4299e1;
    --error-gradient: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
}

/* 다크 모드 */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: rgba(30, 41, 59, 0.95);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-accent: #818cf8;
    
    --border-color: rgba(51, 65, 85, 0.8);
    --shadow-light: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-medium: 0 8px 30px rgba(0, 0, 0, 0.4);
    --shadow-heavy: 0 15px 50px rgba(0, 0, 0, 0.5);

    --error-bg: rgba(239, 68, 68, 0.2);
    --success-bg: rgba(34, 197, 94, 0.2);
    --warning-bg: rgba(245, 158, 11, 0.2);
    --info-bg: rgba(59, 130, 246, 0.2);
    --code-bg: rgba(255, 255, 255, 0.05);
    
    /* 다크 모드 추가 변수들 */
    --surface-color: #1e293b;
    --card-bg: rgba(30, 41, 59, 0.95);
    --error-color: #fc8181;
    --success-color: #68d391;
    --info-color: #63b3ed;
}

[data-theme="dark"] .code-item-footer {
    background: rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .difficulty-star.empty {
    background: rgba(75, 85, 99, 0.5);
}

/* ===== 기본 스타일 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    overflow-y: auto;
    transition: var(--transition-smooth);
    max-width: 100vw;
    box-sizing: border-box;
    height: auto;
    min-height: 100vh;
}

#app {
    height: auto;
    min-height: 100vh;
    overflow: visible;
}

/* ===== 배경 애니메이션 ===== */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: visible;
}

.floating-code {
    position: absolute;
    font-family: 'Fira Code', monospace;
    font-size: 14px;
    color: var(--text-accent);
    opacity: 0.1;
    animation: float 15s infinite linear;
    user-select: none;
}

.floating-code:nth-child(1) {
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.floating-code:nth-child(2) {
    top: 20%;
    right: 15%;
    animation-delay: -3s;
}

.floating-code:nth-child(3) {
    top: 60%;
    left: 5%;
    animation-delay: -6s;
}

.floating-code:nth-child(4) {
    top: 80%;
    right: 20%;
    animation-delay: -9s;
}

.floating-code:nth-child(5) {
    top: 40%;
    right: 5%;
    animation-delay: -12s;
}

@keyframes float {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.1;
    }
    90% {
        opacity: 0.1;
    }
    100% {
        transform: translateY(-100px) rotate(360deg);
        opacity: 0;
    }
}

/* ===== 화면 전환 시스템 ===== */
.screen {
    display: none;
    min-height: auto;
    height: auto;
    padding: 20px;
    opacity: 0;
    transform: translateY(20px);
    transition: var(--transition-smooth);
}

.screen.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* ===== 메인 메뉴 ===== */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    height: auto;
    min-height: auto;
}

.main-header {
    text-align: center;
    margin-bottom: 60px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.logo i {
    font-size: 3rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 900;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ===== 난이도 카드 ===== */
.difficulty-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

.difficulty-card {
    position: relative;
    background: var(--bg-card);
    border-radius: 20px;
    padding: 40px 30px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: 2px solid transparent;
    box-shadow: var(--shadow-light);
    overflow: hidden;
}

.difficulty-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
    transform: scaleX(0);
    transition: var(--transition-smooth);
}

.difficulty-card:hover::before {
    transform: scaleX(1);
}

.difficulty-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-heavy);
    border-color: var(--text-accent);
}

.difficulty-card.beginner .card-icon {
    background: var(--success-gradient);
}

.difficulty-card.intermediate .card-icon {
    background: var(--warning-gradient);
}

.difficulty-card.advanced .card-icon {
    background: var(--secondary-gradient);
}

.card-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    transition: var(--transition-smooth);
}

.card-icon i {
    font-size: 2rem;
    color: white;
}

.difficulty-card h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.difficulty-card p {
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.5;
}

.level-badge {
    display: inline-block;
    background: var(--primary-gradient);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

/* 잠금 상태 */
.difficulty-card.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

.difficulty-card.locked:hover {
    transform: none;
    box-shadow: var(--shadow-light);
}

.lock-overlay {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.5s ease;
    opacity: 1;
}

.lock-overlay.unlocked {
    opacity: 0;
    transform: scale(0.5);
    pointer-events: none;
}

.lock-overlay i {
    color: var(--text-secondary);
    font-size: 1.2rem;
}

/* ===== 메뉴 액션 버튼 ===== */
.menu-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 30px;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    text-decoration: none;
    box-shadow: var(--shadow-light);
}

.stats-btn {
    background: var(--success-gradient);
    color: white;
}

.settings-btn {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.action-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-medium);
}

/* ===== 화면 헤더 ===== */
.screen-header {
    display: flex;
    align-items: flex-start;
    margin-bottom: 30px;
    gap: 20px;
}

.header-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

.back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: var(--shadow-light);
}

.back-btn:hover {
    background: var(--text-accent);
    color: white;
    transform: translateY(-2px);
}

.screen-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.difficulty-header-info {
    text-align: center;
    margin-bottom: 10px;
}

.difficulty-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 8px;
    font-weight: 400;
    font-style: italic;
}

.progress-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 12px;
    font-weight: 500;
}

.progress-stats span {
    font-size: 0.85rem;
    font-weight: 500;
}

#progress-percentage {
    color: var(--text-accent);
    font-weight: 600;
}

.code-list-container {
    margin-top: 20px;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 30px;
    text-align: center;
}

.section-title i {
    font-size: 1.5rem;
    color: var(--text-accent);
}

.section-title h3 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ===== 진행률 표시 ===== */
.progress-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-color);
}

.progress-bar {
    width: 300px;
    height: 10px;
    background: var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--success-gradient);
    border-radius: 4px;
    transition: width 0.5s ease;
    width: 0%;
}

/* ===== 코드 그리드 ===== */
.code-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
    max-width: 1200px;
    margin: 0 auto;
}

.code-item {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 0;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: 2px solid transparent;
    box-shadow: var(--shadow-light);
    position: relative;
    overflow: hidden;
    min-height: 280px;
    display: flex;
    flex-direction: column;
}

.code-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
    transform: scaleX(0);
    transition: var(--transition-smooth);
}

.code-item:hover::before {
    transform: scaleX(1);
}

.code-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-medium);
    border-color: var(--text-accent);
}

.code-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 25px 15px;
    border-bottom: 1px solid var(--border-color);
}

.code-level-badge {
    background: var(--primary-gradient);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.code-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.status-icon.completed {
    background: #48bb78;
    color: white;
}

.status-icon.locked {
    background: #cbd5e0;
    color: #718096;
}

.status-icon.available {
    background: var(--text-accent);
    color: white;
}

.status-icon.partial {
    background: var(--warning-gradient);
    color: white;
}

.code-item-content {
    padding: 20px 25px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.code-item h4 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
    line-height: 1.3;
}

.code-item p {
    color: var(--text-secondary);
    margin-bottom: 15px;
    line-height: 1.5;
    font-size: 0.9rem;
}

.code-preview {
    background: var(--bg-primary);
    padding: 15px;
    border-radius: 8px;
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    color: var(--text-accent);
    border: 1px solid var(--border-color);
    margin: 0;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 80px;
    overflow-y: auto;
    flex: 1;
    margin-top: auto;
}

.code-item-footer {
    padding: 15px 25px;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.02);
}

.code-difficulty {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.difficulty-stars {
    display: flex;
    gap: 2px;
}

.difficulty-star {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.difficulty-star.filled {
    background: var(--warning-gradient);
}

.difficulty-star.empty {
    background: var(--border-color);
}

.code-item.completed {
    border-color: #48bb78;
}

.code-item.completed::before {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    transform: scaleX(1);
}

/* ===== 게임 화면 ===== */
.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
    background: var(--bg-card);
    padding: 20px 30px;
    border-radius: 16px;
    box-shadow: var(--shadow-light);
}

.game-info h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.game-info span {
    color: var(--text-secondary);
    font-size: 1rem;
}

.game-timer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-accent);
}

.game-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto;
    gap: 30px;
    max-width: 1400px;
    margin: 0 auto;
    min-height: auto;
    height: auto;
    padding: 20px;
}

.code-display-section,
.input-section {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 30px;
    box-shadow: var(--shadow-light);
    display: flex;
    flex-direction: column;
}

.code-display-section h4,
.input-section h4 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.code-display {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 25px;
    border: 2px solid var(--border-color);
    min-height: 150px;
}

.code-display pre {
    margin: 0;
    font-family: 'Fira Code', monospace;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
}

.code-display code {
    font-family: inherit;
}

/* 코드 하이라이팅 */
.highlight-correct {
    background-color: #c6f6d5 !important;
    color: #22543d !important;
}

.highlight-error {
    background-color: #fed7d7 !important;
    color: #c53030 !important;
}

.highlight-current {
    background-color: #bee3f8 !important;
    color: #2c5282 !important;
}

#user-input {
    width: 100%;
    min-height: 150px;
    padding: 25px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-family: 'Fira Code', monospace;
    font-size: 16px;
    line-height: 1.6;
    background: var(--bg-primary);
    color: var(--text-primary);
    resize: vertical;
    transition: var(--transition-fast);
}

#user-input:focus {
    outline: none;
    border-color: var(--text-accent);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ===== 통계 패널 ===== */
.stats-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    grid-column: 1 / -1;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--bg-card);
    padding: 25px;
    border-radius: 16px;
    box-shadow: var(--shadow-light);
    transition: var(--transition-smooth);
}

.stat-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-medium);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

.stat-info {
    flex: 1;
}

.stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 5px;
}

/* ===== 결과 화면 ===== */
.result-container {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.result-header {
    margin-bottom: 50px;
}

.result-icon {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--success-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 30px;
    animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.result-icon i {
    font-size: 3rem;
    color: white;
}

@keyframes bounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.result-header h2 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 10px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-header p {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 25px;
    margin-bottom: 50px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.result-stat {
    text-align: center;
}

.stat-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
    animation: fadeInUp 0.6s ease;
}

.result-stat p {
    font-weight: 600;
    color: var(--text-secondary);
}

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

.result-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.result-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 15px 25px;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    text-decoration: none;
    box-shadow: var(--shadow-light);
}

.result-btn.retry {
    background: var(--warning-gradient);
    color: white;
}

.result-btn.next {
    background: var(--primary-gradient);
    color: white;
}

.result-btn.home {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.result-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-medium);
}

/* ===== 코드 실행 결과 섹션 ===== */
.code-execution-section {
    margin: 20px 0;
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow-light);
}

.code-execution-section h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 15px 0 10px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.code-execution-section h3:first-child {
    margin-top: 0;
}

.code-preview {
    background: #2d3748;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    border: 2px solid #4a5568;
    overflow-x: hidden;
    word-wrap: break-word;
    text-align: left;
}

/* 결과 화면에서는 전체 코드 표시 */
.code-execution-section .code-preview {
    max-height: none !important;
    overflow-y: visible !important;
    min-height: 80px;
    background: #2d3748;
    border: 2px solid #4a5568;
    padding: 15px;
    font-size: 1rem;
    margin-bottom: 15px;
}

.code-preview pre {
    margin: 0;
    font-family: 'Fira Code', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
}

.code-preview code {
    color: #f7fafc;
    white-space: pre-wrap;
    word-break: break-word;
    font-weight: 500;
}

.execution-result {
    background: #1a202c;
    border-radius: 12px;
    padding: 15px;
    border: 2px solid #2d3748;
    min-height: 60px;
    font-family: 'Fira Code', monospace;
    position: relative;
    overflow-x: hidden;
    word-wrap: break-word;
    text-align: left;
}

.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-accent);
    font-size: 1rem;
    height: 60px;
}

.loading-spinner i {
    font-size: 1.5rem;
}

.result-output {
    color: #68d391;
    font-size: 1rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    text-align: left;
    font-weight: 500;
}

.result-error {
    color: #fc8181;
    font-size: 1rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    text-align: left;
    font-weight: 500;
}

.result-error::before {
    content: "❌ 오류 발생: ";
    font-size: 1rem;
    font-weight: 600;
    display: block;
    margin-bottom: 8px;
}

.result-output::before {
    content: "✅ 실행 결과: ";
    font-size: 1rem;
    color: #68d391;
    font-weight: 600;
    display: block;
    margin-bottom: 8px;
}

/* ===== 통계 화면 ===== */
.stats-container {
    max-width: 800px;
    margin: 0 auto;
}

.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
}

.summary-card {
    display: flex;
    align-items: center;
    gap: 20px;
    background: var(--bg-card);
    padding: 30px;
    border-radius: 16px;
    box-shadow: var(--shadow-light);
    transition: var(--transition-smooth);
}

.summary-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-medium);
}

.summary-card i {
    font-size: 2.5rem;
    color: var(--text-accent);
}

.summary-card h3 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.summary-card p {
    color: var(--text-secondary);
    font-weight: 500;
}

/* ===== 설정 화면 ===== */
.settings-container {
    max-width: 600px;
    margin: 0 auto;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    padding: 25px;
    border-radius: 16px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-light);
    transition: var(--transition-smooth);
}

.setting-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.setting-info h4 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.setting-info p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* 토글 스위치 */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: var(--transition-fast);
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: var(--transition-fast);
    border-radius: 50%;
}

input:checked + .slider {
    background: var(--primary-gradient);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* ===== 레벨 해금 알림 ===== */
.unlock-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--success-gradient);
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    box-shadow: var(--shadow-heavy);
    z-index: 10000;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
}

.unlock-notification.show {
    transform: translateX(0);
    opacity: 1;
}

.unlock-notification::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1) 25%, transparent 25%),
                linear-gradient(-45deg, rgba(255,255,255,0.1) 25%, transparent 25%),
                linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.1) 75%),
                linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.1) 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    border-radius: 10px;
    animation: celebrate 2s ease infinite;
}

@keyframes celebrate {
    0%, 100% { background-position: 0 0, 0 10px, 10px -10px, -10px 0px; }
    50% { background-position: 10px 0, 10px 10px, 20px -10px, 0px 0px; }
}

/* ===== 반응형 디자인 ===== */
@media (max-width: 768px) {
    .main-container {
        padding: 20px 15px;
    }
    
    .logo h1 {
        font-size: 2rem;
    }
    
    .difficulty-cards {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .menu-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .action-btn {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }
    
    .screen-header {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    
    .header-content {
        padding: 0 10px;
    }
    
    .progress-info {
        width: 100%;
        padding: 15px;
    }
    
    .progress-bar {
        width: 100%;
        max-width: 250px;
    }
    
    .progress-stats {
        gap: 15px;
        font-size: 0.9rem;
    }
    
    .code-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .code-item {
        min-height: 250px;
    }
    
    .code-item-header {
        padding: 15px 20px 12px;
    }
    
    .code-level-badge {
        font-size: 0.75rem;
        padding: 5px 10px;
    }
    
    .status-icon {
        width: 18px;
        height: 18px;
        font-size: 0.7rem;
    }
    
    .code-item-content {
        padding: 15px 20px;
    }
    
    .code-item h4 {
        font-size: 1.1rem;
    }
    
    .code-item p {
        font-size: 0.85rem;
    }
    
    .code-preview {
        font-size: 0.8rem;
        max-height: 60px;
    }
    
    .code-item-footer {
        padding: 12px 20px;
    }
    
    .difficulty-stars {
        gap: 1px;
    }
    
    .difficulty-star {
        width: 10px;
        height: 10px;
    }
    
        .game-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    /* 모바일에서는 1열로 변경 */
    .game-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        height: auto;
        gap: 20px;
        padding: 15px;
    }

    .stats-panel {
        grid-template-columns: 1fr;
        grid-column: 1;
    }
    
    .result-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        max-width: 400px;
    }
    
    .result-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .result-btn {
        width: 100%;
        max-width: 250px;
        justify-content: center;
    }
    
    .code-execution-section {
        margin: 15px 0;
        padding: 15px;
    }
    
    .code-preview,
    .execution-result {
        padding: 12px;
    }
    
    .code-execution-section h3 {
        font-size: 1.1rem;
        margin: 10px 0 8px 0;
    }
    
    .code-execution-section h3:first-child {
        margin-top: 0;
    }
    
    .stats-summary {
        grid-template-columns: 1fr;
    }
    
    .setting-item {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .screen {
        padding: 15px 10px;
    }
    
    .code-display,
    #user-input {
        padding: 20px;
        font-size: 14px;
    }
    
    .floating-code {
        font-size: 12px;
    }
}

/* ===== 스크롤바 스타일 ===== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--text-accent);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-primary);
}

/* ===== 포커스 스타일 ===== */
button:focus,
.difficulty-card:focus,
.code-item:focus {
    outline: 2px solid var(--text-accent);
    outline-offset: 2px;
}

/* ===== 로딩 애니메이션 ===== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== 성공 애니메이션 ===== */
.success-animation {
    animation: pulse 0.6s ease-in-out;
}

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

/* 오탈자 팝업 스타일 */
.error-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.error-popup.show {
    opacity: 1;
    visibility: visible;
}

.error-popup-content {
    background: var(--surface-color);
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border: 2px solid var(--error-color);
}

.error-header {
    background: var(--error-gradient);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 14px 14px 0 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.error-header h3 {
    margin: 0;
    flex: 1;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.error-body {
    padding: 1.5rem;
}

.error-message {
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--error-bg);
    border-radius: 8px;
    border-left: 4px solid var(--error-color);
}

.error-details {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
}

.error-location,
.error-comparison,
.error-context {
    margin-bottom: 0.75rem;
}

.error-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.expected,
.actual {
    padding: 0.5rem;
    border-radius: 4px;
}

.expected {
    background: var(--success-bg);
    border-left: 3px solid var(--success-color);
}

.actual {
    background: var(--error-bg);
    border-left: 3px solid var(--error-color);
}

.context-line {
    display: block;
    background: var(--code-bg);
    padding: 0.5rem;
    border-radius: 4px;
    font-family: 'Fira Code', monospace;
    margin-top: 0.25rem;
}

.multiple-errors {
    background: var(--warning-bg);
    border-left: 4px solid var(--warning-color);
    padding: 0.75rem;
    border-radius: 4px;
    margin: 1rem 0;
}

.error-tips {
    background: var(--info-bg);
    border-left: 4px solid var(--info-color);
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
}

.error-tips h4 {
    margin: 0 0 0.5rem 0;
    color: var(--info-color);
}

.error-tips ul {
    margin: 0;
    padding-left: 1.25rem;
}

.error-tips li {
    margin-bottom: 0.25rem;
}

.code-requirement {
    margin: 20px 0;
    padding: 0;
}

.requirement-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    border-left: 4px solid;
    background: rgba(0, 0, 0, 0.03);
}

.requirement-item:first-child {
    background: var(--error-bg);
    border-left-color: var(--error-color);
}

.requirement-item:last-child {
    background: var(--success-bg);
    border-left-color: var(--success-color);
    margin-bottom: 0;
}

.requirement-item i {
    font-size: 16px;
    flex-shrink: 0;
}

.requirement-item:first-child i {
    color: var(--error-color);
}

.requirement-item:last-child i {
    color: var(--success-color);
}

.requirement-item span {
    font-size: 14px;
    line-height: 1.5;
}

.error-lines {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.error-line-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 6px;
    border-left: 3px solid var(--text-accent);
}

.error-line-item i {
    color: var(--text-accent);
    font-size: 14px;
    flex-shrink: 0;
}

.error-line-item span {
    font-size: 14px;
    color: var(--text-primary);
}

/* 다크 모드 스타일 */
[data-theme="dark"] .requirement-item {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .requirement-item:first-child {
    background: var(--error-bg);
}

[data-theme="dark"] .requirement-item:last-child {
    background: var(--success-bg);
}

[data-theme="dark"] .error-line-item {
    background: rgba(255, 255, 255, 0.05);
}

.error-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    padding: 1rem 1.5rem;
    background: var(--card-bg);
    border-radius: 0 0 14px 14px;
}

/* 기존 오탈자 팝업 스타일에 추가 */

.error-summary {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    border: 1px solid var(--border-color);
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.summary-item:last-child {
    margin-bottom: 0;
}

.error-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--surface-color);
}

.error-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.error-item:last-child {
    border-bottom: none;
}

.error-number {
    background: var(--error-color);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    flex-shrink: 0;
}

.error-info {
    flex: 1;
}

.error-location {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.error-comparison-inline {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
}

.expected-char {
    color: var(--success-color);
}

.actual-char {
    color: var(--error-color);
}

.more-errors {
    padding: 0.75rem;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* 반응형 */
@media (max-width: 768px) {
    .error-comparison-inline {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .error-list {
        max-height: 150px;
    }
}

/* 버튼 스타일 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
    box-shadow: var(--shadow-light);
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
    border-color: var(--text-accent);
}

/* ===== CodeMirror 커스텀 스타일 ===== */
.code-editor-container {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-light);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
    height: auto;
    min-height: 400px;
    max-height: 600px;
}

.CodeMirror {
    height: auto !important;
    min-height: 300px !important;
    max-height: 600px !important;
    font-family: 'Fira Code', monospace !important;
    font-size: 14px !important;
    line-height: 1.6 !important;
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border: none !important;
    overflow-y: auto !important;
}

.CodeMirror-gutters {
    background: var(--bg-primary) !important;
    border-right: 1px solid var(--border-color) !important;
    width: 50px !important;
}

.CodeMirror-linenumber {
    color: var(--text-secondary) !important;
    font-size: 12px !important;
    font-family: 'Fira Code', monospace !important;
    padding: 0 8px !important;
    text-align: right !important;
}

.CodeMirror-cursor {
    border-left: 2px solid var(--text-accent) !important;
}

/* 타겟 코드 에디터 (읽기 전용) */
#target-code-editor .CodeMirror {
    background: var(--code-bg) !important;
}

#target-code-editor .CodeMirror-gutters {
    background: var(--bg-primary) !important;
}

/* 사용자 입력 에디터 */
#user-input-editor .CodeMirror-focused {
    outline: 2px solid var(--text-accent) !important;
    outline-offset: -2px !important;
}

/* 라인별 하이라이트 */
.line-error {
    background: var(--error-bg) !important;
    border-left: 4px solid var(--error-color) !important;
    padding-left: 8px !important;
}

.line-correct {
    background: var(--success-bg) !important;
    border-left: 4px solid var(--success-color) !important;
    padding-left: 8px !important;
}

.line-current {
    background: var(--info-bg) !important;
    border-left: 4px solid var(--info-color) !important;
    padding-left: 8px !important;
}

.line-incomplete {
    background: var(--warning-bg) !important;
    border-left: 4px solid var(--warning-color) !important;
    padding-left: 8px !important;
}

/* 다크 모드용 CodeMirror 스타일 */
[data-theme="dark"] .CodeMirror {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .CodeMirror-gutters {
    background: var(--bg-primary) !important;
    border-right-color: var(--border-color) !important;
}

[data-theme="dark"] #target-code-editor .CodeMirror {
    background: var(--code-bg) !important;
}

/* 라인 상태 거터 스타일 */
.line-status-gutter {
    width: 20px !important;
}

.line-status-marker {
    font-size: 12px !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 100% !important;
}

/* 타겟 에디터 거터 확장 (라인 번호 + 상태) */
#target-code-editor .CodeMirror-gutters {
    width: 70px !important;
}

/* 반응형 CodeMirror */
@media (max-width: 768px) {
    .CodeMirror {
        min-height: 250px !important;
        max-height: 500px !important;
        font-size: 13px !important;
    }
    
    .CodeMirror-gutters {
        width: 45px !important;
    }
    
    #target-code-editor .CodeMirror-gutters {
        width: 65px !important;
    }
    
    .CodeMirror-linenumber {
        font-size: 11px !important;
        padding: 0 6px !important;
    }
    
    .line-status-marker {
        font-size: 11px !important;
    }
}

@media (max-width: 480px) {
    .CodeMirror {
        min-height: 200px !important;
        max-height: 400px !important;
        font-size: 12px !important;
    }
    
    .CodeMirror-gutters {
        width: 40px !important;
    }
    
    #target-code-editor .CodeMirror-gutters {
        width: 60px !important;
    }
    
    .CodeMirror-linenumber {
        font-size: 10px !important;
        padding: 0 4px !important;
    }
    
    .line-status-marker {
        font-size: 10px !important;
    }
}

/* ===== 커스텀 VSCode 스타일 에디터 ===== */

/* 에디터 컨테이너 */
.custom-editor {
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-medium);
    border: 1px solid var(--border-color);
    height: auto;
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}

/* 게임 컨테이너 내 에디터 스타일 */
.game-container .custom-editor {
    flex: 1;
    height: auto;
    min-height: 400px;
    max-height: 600px;
    margin-bottom: 0;
}

.custom-editor:hover {
    box-shadow: var(--shadow-heavy);
}

/* 에디터 헤더 (VSCode 탭 스타일) */
.editor-header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 0;
    height: 40px;
    display: flex;
    align-items: center;
}

.editor-tabs {
    display: flex;
    height: 100%;
}

.editor-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 13px;
    font-family: 'Fira Code', monospace;
    min-width: 120px;
    height: 100%;
    position: relative;
}

.editor-tab.active {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-bottom: 2px solid var(--text-accent);
}

.editor-tab i {
    color: #3776ab;
    font-size: 14px;
}

/* 에디터 컨텐츠 */
.editor-content {
    flex: 1;
    display: flex;
    position: relative;  
    overflow: hidden;
    align-items: flex-start;
}

/* 라인 번호 */
.line-numbers {
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    padding: 12px 8px 12px 8px;
    font-family: 'Fira Code', monospace;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    min-width: 50px;
    text-align: right;
    user-select: none;
    overflow: hidden;
    box-sizing: border-box;
    flex-shrink: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
    height: auto;
}

.line-numbers::-webkit-scrollbar {
    display: none;
}

.line-number {
    position: relative;
    padding: 0;
    margin: 0;
    height: 22.4px;
    line-height: 22.4px;
    display: block;
    text-align: right;
    padding-right: 8px;
}

/* 라인 번호 상태 표시 */
.line-number::after {
    content: attr(data-status);
    position: absolute;
    right: -12px;
    width: 16px;
    text-align: center;
    font-size: 10px;
    font-weight: bold;
}

.line-number.line-correct::after {
    color: var(--success-color);
}

.line-number.line-error::after {
    color: var(--error-color);
}

.line-number.line-current::after {
    color: var(--info-color);
}

.line-number.line-incomplete::after {
    color: #ed8936;
}

/* 타겟 코드 (읽기 전용) */
.code-content {
    flex: 1;
    padding: 12px 16px 12px 16px;
    font-family: 'Fira Code', monospace;
    font-size: 14px;
    line-height: 22.4px;
    color: var(--text-primary);
    background: var(--bg-secondary);
    overflow: hidden;
    white-space: pre;
    border: none;
    outline: none;
    margin: 0;
    box-sizing: border-box;
    height: auto;
}

.code-content::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.code-content::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-radius: 6px;
}

.code-content::-webkit-scrollbar-thumb {
    background: var(--text-secondary);
    border-radius: 6px;
    border: 2px solid var(--bg-secondary);
}

.code-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-primary);
}

.code-content::-webkit-scrollbar-corner {
    background: var(--bg-primary);
}

/* 사용자 입력 에디터 */
.code-input {
    flex: 1;
    padding: 12px 16px 12px 16px;
    font-family: 'Fira Code', monospace;
    font-size: 14px;
    line-height: 22.4px;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: none;
    outline: none;
    resize: none;
    overflow: hidden;
    white-space: pre;
    word-wrap: normal;
    overflow-wrap: normal;
    box-sizing: border-box;
    height: auto;
}

.code-input::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.code-input::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-radius: 6px;
}

.code-input::-webkit-scrollbar-thumb {
    background: var(--text-secondary);
    border-radius: 6px;
    border: 2px solid var(--bg-secondary);
}

.code-input::-webkit-scrollbar-thumb:hover {
    background: var(--text-primary);
}

.code-input::-webkit-scrollbar-corner {
    background: var(--bg-primary);
}

.code-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.code-input:focus {
    background: var(--bg-secondary);
}

/* 사용자 에디터 특별 스타일 */
.user-editor {
    border: 2px solid var(--text-accent);
}

.user-editor:focus-within {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Python 구문 하이라이팅 */
.syntax-keyword {
    color: #c586c0;
    font-weight: 600;
}

.syntax-string {
    color: #ce9178;
}

.syntax-number {
    color: #b5cea8;
}

.syntax-comment {
    color: #6a9955;
    font-style: italic;
}

/* 다크 테마 조정 */
[data-theme="dark"] .custom-editor {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

[data-theme="dark"] .editor-header {
    background: var(--bg-primary);
}

[data-theme="dark"] .editor-tab {
    background: var(--bg-primary);
    color: var(--text-secondary);
}

[data-theme="dark"] .editor-tab.active {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

[data-theme="dark"] .line-numbers {
    background: var(--bg-primary);
}

[data-theme="dark"] .syntax-keyword {
    color: #c586c0;
}

[data-theme="dark"] .syntax-string {
    color: #ce9178;
}

[data-theme="dark"] .syntax-number {
    color: #b5cea8;
}

[data-theme="dark"] .syntax-comment {
    color: #6a9955;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .custom-editor {
        height: auto;
        margin-bottom: 15px;
    }
    
    .editor-tab {
        padding: 0 12px;
        min-width: 100px;
        font-size: 12px;
    }
    
    .code-content,
    .code-input {
        font-size: 13px;
        line-height: 20.8px;
        padding: 10px 12px 10px 12px;
    }
    
    .line-numbers {
        font-size: 13px;
        padding: 10px 6px 10px 6px;
        min-width: 45px;
    }
    
    .line-number {
        height: 20.8px;
        line-height: 20.8px;
    }
}

@media (max-width: 480px) {
    .custom-editor {
        height: auto;
        margin-bottom: 10px;
    }
    
    .editor-tab {
        padding: 0 8px;
        min-width: 80px;
        font-size: 11px;
    }
    
    .code-content,
    .code-input {
        font-size: 12px;
        line-height: 19.2px;
        padding: 8px 10px 8px 10px;
    }
    
    .line-numbers {
        font-size: 12px;
        padding: 8px 4px 8px 4px;
        min-width: 40px;
    }
    
    .line-number {
        height: 19.2px;
        line-height: 19.2px;
    }
}

/* ===== 코드 길이 선택 화면 스타일 ===== */
.length-selection-container {
    max-width: 1000px;
    margin: 0 auto;
}

.length-selection-header {
    text-align: center;
    margin-bottom: 40px;
}

.length-selection-header h2 {
    font-size: 2rem;
    margin-bottom: 10px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.length-selection-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.length-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.code-length-card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--shadow-light);
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.code-length-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--primary-gradient);
    opacity: 0;
    transition: var(--transition-smooth);
    z-index: -1;
}

.code-length-card:hover::before {
    opacity: 0.1;
}

.code-length-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-medium);
    border-color: var(--text-accent);
}

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

.length-icon {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.length-info h3 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 5px;
    color: var(--text-primary);
}

.length-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.length-card-body {
    margin-bottom: 25px;
}

.length-description {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
}

.length-progress {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.length-progress .progress-bar {
    flex: 1;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.length-progress .progress-fill {
    height: 100%;
    background: var(--success-gradient);
    border-radius: 4px;
    transition: var(--transition-smooth);
}

.length-progress .progress-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-accent);
    white-space: nowrap;
}

.length-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.difficulty-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.difficulty-badge.beginner {
    background: var(--success-bg);
    color: var(--success-color);
}

.difficulty-badge.intermediate {
    background: var(--warning-bg);
    color: #f59e0b;
}

.difficulty-badge.advanced {
    background: var(--error-bg);
    color: var(--error-color);
}

.completion-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--info-bg);
    color: var(--info-color);
}

.completion-badge.complete {
    background: var(--success-bg);
    color: var(--success-color);
}

.code-category {
    margin-bottom: 15px;
}

.category-badge {
    display: inline-block;
    padding: 4px 8px;
    background: var(--info-bg);
    color: var(--info-color);
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
}

.example-count-badge {
    display: inline-block;
    padding: 3px 8px;
    background: var(--warning-gradient);
    color: white;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 8px;
}

.progress-badge {
    display: inline-block;
    padding: 2px 6px;
    background: var(--info-color);
    color: white;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 5px;
}

/* 뒤로가기 네비게이션 */
.back-navigation {
    margin-bottom: 30px;
}

.back-navigation .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* 결과 화면 버튼 개선 */
.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

.result-actions .btn {
    flex: 0 1 auto;
    min-width: 160px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.result-actions .btn-primary {
    background: var(--primary-gradient);
    color: white;
}

.result-actions .btn-secondary {
    background: var(--secondary-gradient);
    color: white;
}

.result-actions .btn-success {
    background: var(--success-gradient);
    color: white;
}

.result-actions .btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
}

.result-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.result-actions .btn-outline:hover {
    background: var(--bg-secondary);
    border-color: var(--text-accent);
    color: var(--text-accent);
}

/* 반응형 스타일 */
@media (max-width: 768px) {
    .length-cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 20px;
        padding: 0 10px;
    }
    
    .code-length-card {
        padding: 20px;
    }
    
    .length-info h3 {
        font-size: 1.1rem;
    }
    
    .result-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .result-actions .btn {
        min-width: auto;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .length-cards-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 0 15px;
    }
    
    .code-length-card {
        padding: 15px;
    }
    
    .length-card-header {
        gap: 15px;
    }
    
    .length-icon {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .length-info h3 {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .length-selection-header h2 {
        font-size: 1.5rem;
    }
    
    .length-selection-header p {
        font-size: 1rem;
    }
    
    .code-length-card {
        padding: 15px;
    }
    
    .length-card-header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .length-info h3 {
        font-size: 1.1rem;
    }
} 

/* ===== 스크롤 문제 해결을 위한 추가 스타일 ===== */

/* 모든 주요 컨테이너의 높이 제한 해제 */
html, body, #app {
    height: auto !important;
    min-height: 100vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

/* 게임 화면과 모든 스크린에서 자연스러운 스크롤 허용 */
.screen {
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

/* 게임 컨테이너 높이 제한 완전 해제 */
.game-container {
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
}

/* 모든 섹션과 카드에서 자연스러운 높이 */
.code-display-section, 
.input-section,
.stats-panel,
.result-container,
.main-container {
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
}

/* 에디터 내부 스크롤이 올바르게 작동하도록 */
.code-content,
.code-input,
.line-numbers {
    overflow-y: auto !important;
    overflow-x: auto !important;
}

/* 배경 애니메이션이 스크롤에 영향 주지 않도록 */
.bg-animation {
    overflow: visible !important;
    pointer-events: none !important;
}

/* 코드 에디터가 항상 스크롤 가능하도록 */
.custom-editor .editor-content {
    overflow: visible !important;
}

/* 반응형에서도 높이 제한 해제 */
@media (max-width: 768px) {
    .game-container,
    .screen,
    .main-container {
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
    }
    
    .code-content,
    .code-input,
    .line-numbers {
        overflow-y: auto !important;
        overflow-x: auto !important;
    }
}

@media (max-width: 480px) {
    .game-container,
    .screen,
    .main-container {
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
    }
    
    .code-content,
    .code-input,
    .line-numbers {
        overflow-y: auto !important;
        overflow-x: auto !important;
    }
} 

/* 패키지 설치 진행 상황 */
.installation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.installation-modal {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

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

.installation-header i {
    font-size: 24px;
    color: #3498db;
    margin-right: 10px;
}

.installation-header h3 {
    margin: 0;
    color: #2c3e50;
}

.installation-content p {
    margin-bottom: 15px;
    color: #7f8c8d;
}

#installation-list {
    list-style: none;
    padding: 0;
}

#installation-list li {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #ecf0f1;
}

#installation-list li:last-child {
    border-bottom: none;
}

#installation-list li i {
    margin-right: 12px;
    width: 16px;
    color: #3498db;
}

#installation-list li span:first-of-type {
    font-weight: 500;
    flex: 1;
}

.install-status {
    font-size: 14px;
    color: #7f8c8d;
}

/* 다크 모드 지원 */
body.dark-mode .installation-modal {
    background: var(--dark-bg-secondary);
    color: var(--dark-text-primary);
}

body.dark-mode .installation-header h3 {
    color: var(--dark-text-primary);
}

body.dark-mode .installation-content p {
    color: var(--dark-text-secondary);
}

body.dark-mode #installation-list li {
    border-bottom-color: var(--dark-border);
}

body.dark-mode .install-status {
    color: var(--dark-text-secondary);
} 

/* ===== Footer 스타일 ===== */
.app-footer {
    width: 100%;
    padding: 30px 20px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    margin-top: 30px; /* 60px에서 30px로 줄임 */
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.footer-content a {
    display: inline-block;
    text-decoration: none;
    transition: var(--transition-smooth);
}

.footer-logo {
    max-width: 250px; /* 150px에서 200px로 증가 */
    height: auto;
    opacity: 0.8;
    transition: var(--transition-smooth);
    filter: grayscale(20%);
}

.footer-logo:hover {
    opacity: 1;
    filter: grayscale(0%);
    transform: scale(1.05);
}

.footer-content a:hover {
    transform: translateY(-2px);
}

/* 다크 모드 지원 */
[data-theme="dark"] .app-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

[data-theme="dark"] .footer-logo {
    filter: grayscale(20%) brightness(0.9);
}

[data-theme="dark"] .footer-logo:hover {
    filter: grayscale(0%) brightness(1);
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .app-footer {
        padding: 25px 15px;
        margin-top: 25px; /* 40px에서 25px로 줄임 */
    }
    
    .footer-logo {
        max-width: 160px; /* 120px에서 160px로 증가 */
    }
}

@media (max-width: 480px) {
    .app-footer {
        padding: 20px 10px;
        margin-top: 20px; /* 30px에서 20px로 줄임 */
    }
    
    .footer-logo {
        max-width: 130px; /* 100px에서 130px로 증가 */
    }
} 