:root {
    /* Colors */
    --primary-color: #6a11cb;
    --secondary-color: #2575fc;
    --accent-color: #ff4b1f;
    --text-color: #333;
    --text-light: #fff;
    --bg-gradient: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);

    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);

    /* Spacing */
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Noto Sans KR', 'Noto Sans JP', sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    color: var(--text-color);
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* Align top for scrolling content */
    padding: var(--spacing-md);
}

/* Background Shapes */
.background-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: float 20s infinite;
}

.shape-1 {
    top: -10%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: #ff9a9e;
    animation-delay: 0s;
}

.shape-2 {
    bottom: -10%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: #a18cd1;
    animation-delay: -5s;
}

.shape-3 {
    top: 40%;
    left: 40%;
    width: 300px;
    height: 300px;
    background: #fbc2eb;
    animation-delay: -10s;
}

@keyframes float {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }

    33% {
        transform: translate(30px, -50px) rotate(10deg);
    }

    66% {
        transform: translate(-20px, 20px) rotate(-5deg);
    }

    100% {
        transform: translate(0, 0) rotate(0deg);
    }
}

/* Container */
.container {
    width: 100%;
    max-width: 600px;
    /* Mobile-first optimization */
    margin-top: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

/* Glass Card */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Fix: Only interactive cards hover */
.glass-card.interactive:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.2);
    cursor: pointer;
}

/* Typography */
h1,
h2,
h3 {
    margin-bottom: var(--spacing-md);
    color: #2d3436;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
}

h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

p {
    line-height: 1.6;
    margin-bottom: var(--spacing-md);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    text-decoration: none;
    width: 100%;
    /* Full width on mobile */
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(118, 75, 162, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(118, 75, 162, 0.6);
}

.btn-secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-secondary:hover {
    background: #f0f4ff;
}

.btn-danger {
    background: #ff6b6b;
    color: white;
}

/* Progress Bar */
.progress-container {
    width: 100%;
    height: 10px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 5px;
    overflow: hidden;
    margin-top: var(--spacing-sm);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #00c6ff, #0072ff);
    width: 0%;
    transition: width 0.5s ease;
}

/* Utility */
.text-center {
    text-align: center;
}

.mt-1 {
    margin-top: var(--spacing-sm);
}

.mt-2 {
    margin-top: var(--spacing-md);
}

.mb-1 {
    margin-bottom: var(--spacing-sm);
}

.mb-2 {
    margin-bottom: var(--spacing-md);
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

/* Quiz Styles */
.quiz-header-info {
    white-space: nowrap;
    font-weight: bold;
}

.quiz-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

.btn-option {
    background: white;
    border: 2px solid transparent;
    padding: 20px;
    font-size: 1.2rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.btn-option:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.btn-option.correct {
    background: #55efc4;
    color: #006266;
    border-color: #00b894;
    animation: pulse 0.5s ease;
}

.btn-option.wrong {
    background: #ff7675;
    color: white;
    border-color: #d63031;
    animation: shake 0.5s ease;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes shake {
    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    50% {
        transform: translateX(5px);
    }

    75% {
        transform: translateX(-5px);
    }

    100% {
        transform: translateX(0);
    }
}

/* --- Tab System --- */
.tab-container {
    display: flex;
    justify-content: center;
    margin-bottom: var(--spacing-md);
    background: rgba(255, 255, 255, 0.4);
    border-radius: var(--radius-md);
    padding: 6px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.tab-button {
    flex: 1;
    padding: 14px;
    border: none;
    background: transparent;
    color: #666;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
}

.tab-button:hover {
    background: rgba(255, 255, 255, 0.5);
    color: var(--primary-color);
}

.tab-button.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transform: scale(1.02);
}

/* --- Character Table --- */
.char-table-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.char-cell {
    background: rgba(255, 255, 255, 0.6);
    border-radius: 8px;
    padding: 10px 5px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.char-cell:hover {
    transform: scale(1.05);
    background: rgba(255, 255, 255, 0.9);
}

.char-main {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
}

.char-sub {
    font-size: 0.8rem;
    color: #666;
    margin-top: 2px;
}

.char-empty {
    background: transparent;
}

/* --- Word Learning --- */