@import url('https://fonts.googleapis.com/css2?family=Josefin+Sans:ital,wght@0,100..700;1,100..700&display=swap');

:root {
    --vla-primary: #d32f2f; --vla-secondary: #00796b; --vla-bg: #fffcf5;
    --vla-text: #3E2723; --vla-card-bg: #ffffff; --vla-shadow: rgba(0, 0, 0, 0.07);
    /* Vowel group colors */
    --v-color-a: #fff0f0; --v-color-ă: #ffe0b2; --v-color-â: #d7ccc8;
    --v-color-e: #e0f7fa; --v-color-ê: #dcedc8;
    --v-color-i: #f3e5f5;
    --v-color-o: #fff8e1; --v-color-ô: #ffecb3; --v-color-ơ: #fbe9e7;
    --v-color-u: #e8f5e9; --v-color-ư: #d1c4e9;
    --v-color-y: #f1f8e9;
}
.vla-container { max-width: 900px; margin: 20px auto; padding: 20px; font-family: 'Josefin Sans', sans-serif; background: var(--vla-bg); border-radius: 16px; box-shadow: 0 8px 25px var(--vla-shadow); position: relative; border: 1px solid #e0e0e0; }
.vla-fullscreen-btn { position: absolute; top: 15px; right: 15px; background: rgba(0,0,0,0.05); border: 1px solid rgba(0,0,0,0.1); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 18px; line-height: 30px; text-align: center; }
.vla-header { text-align: center; color: var(--vla-primary); margin-bottom: 20px; }
.vla-title { font-size: 2em; font-weight: bold; margin: 0; }
.vla-learning-modes { display: flex; justify-content: center; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; border-bottom: 2px solid #eee; padding-bottom: 20px; }
.vla-learning-mode-btn { background: var(--vla-card-bg); border: 1px solid #ddd; padding: 8px 16px; border-radius: 25px; font-size: 0.9em; font-weight: 600; cursor: pointer; transition: all 0.3s ease; box-shadow: 0 2px 5px var(--vla-shadow); color: var(--vla-secondary); }
.vla-learning-mode-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 8px var(--vla-shadow); }
.vla-learning-mode-btn.active { background: var(--vla-secondary); color: white; border-color: var(--vla-secondary); }
.vla-content { padding: 10px 0; }
.vla-view { display: none; animation: fadeIn 0.5s; }
.vla-view.active { display: block; }
.vla-section-title { font-size: 1.5em; color: var(--vla-primary); margin: 20px 0 15px; padding-bottom: 5px; border-bottom: 2px solid var(--vla-primary); }
.vla-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 15px; margin-bottom: 20px; }
.vla-char-card, .vla-lecture-card { background: var(--vla-card-bg); border-radius: 12px; padding: 10px; text-align: center; cursor: pointer; transition: all 0.2s ease; border: 1px solid #e0e0e0; box-shadow: 0 2px 8px var(--vla-shadow); font-size: 2.2em; font-weight: 500; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.vla-char-card-mixed { font-size: 1.6em; }
.vla-char-card:hover, .vla-lecture-card:hover { transform: translateY(-4px); box-shadow: 0 6px 12px var(--vla-shadow); border-color: var(--vla-secondary); }
.vla-lecture-card { font-size: 1.1em; }
.vla-case-selector { display: flex; gap: 10px; margin-bottom: 20px; align-items: center; }
.vla-case-btn { background: #eee; border: none; padding: 8px 15px; border-radius: 8px; font-weight: 600; cursor: pointer; }
.vla-case-btn.active { background: var(--vla-primary); color: white; }

/* Post Lecture content */
.vla-post-content { padding: 10px 20px; background: var(--vla-card-bg); border-radius: 12px; border: 1px solid #eee; }
.vla-post-content h1, .vla-post-content h2, .vla-post-content h3 { color: var(--vla-primary); }
.vla-post-content img { max-width: 100%; height: auto; border-radius: 8px; }
.vla-lecture-tabs { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 15px; border-bottom: 1px solid #ddd; }
.vla-lecture-tab-btn { background: #f1f1f1; border: 1px solid #ddd; border-bottom: none; padding: 8px 15px; cursor: pointer; border-radius: 8px 8px 0 0; font-weight: 600; }
.vla-lecture-tab-btn.active { background: var(--vla-card-bg); border-color: #ddd; border-bottom-color: var(--vla-card-bg); position: relative; top: 1px; }
.vla-lecture-tab-content { display: none; }
.vla-lecture-tab-content.active { display: block; }

/* Vowel Groups Layout */
#tones-view .vla-case-selector { margin-top: 20px; }
.vowel-grid { display: flex; flex-direction: column; gap: 10px; }
.vla-vowel-group-card { display: flex; align-items: center; gap: 15px; background: #fafafa; border-radius: 12px; padding: 10px 15px; border: 1px solid #eee; }
.vla-vowel-base { font-size: 2.8em; font-weight: bold; cursor: pointer; min-width: 40px; text-align: center; }
.vla-vowel-variants { display: flex; flex-wrap: wrap; gap: 8px; }
.vla-char-mini { font-size: 1.5em; cursor: pointer; padding: 5px 8px; border-radius: 6px; transition: all 0.2s; }
.vla-char-mini:hover { transform: scale(1.2); box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
/* Vowel group coloring */
.vla-char-mini.v-group-a { background-color: var(--v-color-a); }
.vla-char-mini.v-group-e { background-color: var(--v-color-e); }
.vla-char-mini.v-group-ê { background-color: var(--v-color-ê); }
.vla-char-mini.v-group-i { background-color: var(--v-color-i); }
.vla-char-mini.v-group-o { background-color: var(--v-color-o); }
.vla-char-mini.v-group-ô { background-color: var(--v-color-ô); }
.vla-char-mini.v-group-ơ { background-color: var(--v-color-ơ); }
.vla-char-mini.v-group-u { background-color: var(--v-color-u); }
.vla-char-mini.v-group-ư { background-color: var(--v-color-ư); }
.vla-char-mini.v-group-y { background-color: var(--v-color-y); }

/* Modal */
.vla-modal { display: none; position: fixed; z-index: 1001; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); align-items: center; justify-content: center; overflow-y: auto; padding: 20px 0; }
.vla-modal.active { display: flex; }
.vla-modal-content { background: var(--vla-bg); padding: 15px; border-radius: 16px; max-width: 420px; width: 95%; animation: slideIn 0.3s ease; box-shadow: 0 8px 30px rgba(0,0,0,0.3); position: relative; max-height: 95vh; overflow-y: auto; }
.vla-modal-content.wide { max-width: 700px; }
.vla-modal-close { position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,0.1); border: none; font-size: 20px; cursor: pointer; color: #333; width: 30px; height: 30px; border-radius: 50%; z-index: 10; }
.vla-modal-title { text-align: center; font-size: 1.6em; color: var(--vla-primary); margin-bottom: 15px; }
.vla-character-large { font-size: 5em; text-align: center; color: var(--vla-primary); line-height: 1.1; word-break: break-all; }
.vla-character-large[data-char-length="3"] { font-size: 4em; }
.vla-character-info { text-align: center; margin-bottom: 15px; }
.vla-audio-btn { transition: all 0.2s ease; }
.vla-audio-btn.playing { animation: pulse 0.8s infinite; box-shadow: 0 0 0 4px rgba(0, 121, 107, 0.4); }
.vla-audio-btn-large { background: var(--vla-secondary); color: white; border: none; padding: 8px 20px; border-radius: 30px; font-size: 0.9em; cursor: pointer; }
.vla-modal-section { margin-top: 10px; padding: 10px; background: var(--vla-card-bg); border-radius: 12px; border: 1px solid #eee; }
.vla-modal-section h4 { font-size: 1.1em; color: var(--vla-secondary); margin: 0 0 8px 0; }
.vla-stroke-container { text-align: center; min-height: 150px; display: flex; justify-content: center; align-items: center; background: #f5f5f5; border-radius: 8px; padding: 5px; }
.vla-stroke-container img, .vla-stroke-container video { max-width: 100%; max-height: 200px; border-radius: 5px; }
.vla-default-char { font-size: 3em; color: #ccc; }
.vla-default-char.large { font-size: 5em; }
.vla-video-wrapper { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; margin-bottom: 15px; border-radius: 8px; }
.vla-video-wrapper.stroke-video { max-height: 200px; padding-bottom: 0; height: 200px; }
.vla-video-wrapper iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.vla-modal-nav { display: flex; justify-content: space-between; padding: 5px 0 0 0; }
.vla-modal-nav button { background: rgba(0,0,0,0.1); border: none; border-radius: 50%; width: 40px; height: 40px; font-size: 20px; cursor: pointer; }

/* Example Slider */
.vla-slider { position: relative; text-align: center; }
.vla-slider-btn { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,0.2); color: white; border: none; border-radius: 50%; width: 35px; height: 35px; font-size: 20px; cursor: pointer; z-index: 1; }
.vla-slider-btn.example-prev { left: 5px; }
.vla-slider-btn.example-next { right: 5px; }
.vla-example-slide-content { padding: 5px; }
.vla-example-slide-word { font-size: 2.5em; font-weight: bold; margin-bottom: 5px; }
.vla-highlight { color: var(--vla-primary); }
.vla-example-slide-img { height: 150px; display: flex; align-items: center; justify-content: center; margin-bottom: 5px; }
.vla-example-slide-img img, .vla-example-slide-img video { max-height: 100%; max-width: 100%; border-radius: 8px; }
.vla-audio-btn.example-slide-audio { background: none; border: none; font-size: 1.8em; cursor: pointer; }

/* Flashcard & Practice */
.vla-mode-options { padding: 0 10px 15px; border-bottom: 1px solid #eee; margin-bottom: 15px; }
.vla-flashcard-container { max-width: 400px; margin: 20px auto; }
.vla-flashcard { width: 100%; height: 200px; perspective: 1000px; cursor: pointer; }
.vla-flashcard-inner { position: relative; width: 100%; height: 100%; transition: transform 0.6s; transform-style: preserve-3d; }
.vla-flashcard.flipped .vla-flashcard-inner { transform: rotateY(180deg); }
.vla-flashcard-front, .vla-flashcard-back { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; align-items: center; justify-content: center; border-radius: 16px; box-shadow: 0 5px 20px var(--vla-shadow); color: white; }
.vla-flashcard-front { background: linear-gradient(135deg, #ff8a65, #e65100); }
.vla-flashcard-back { background: linear-gradient(135deg, #4db6ac, #004d40); transform: rotateY(180deg); }
.vla-character-display { font-size: 6em; }
.vla-flashcard-controls { display: flex; justify-content: center; gap: 10px; margin-top: 20px; }
.vla-btn { background: var(--vla-secondary); color: white; border: none; padding: 10px 15px; border-radius: 8px; cursor: pointer; font-weight: 600; }
#practice-case-selector .vla-btn { background: #eee; color: var(--vla-text); }
#practice-case-selector .vla-btn:hover { background: #ddd; }

.vla-practice-container { max-width: 350px; margin: 20px auto; text-align: center; }
.vla-canvas-wrapper { position: relative; width: 300px; height: 300px; margin: 10px auto; }
#practice-canvas { border: 2px solid var(--vla-secondary); border-radius: 10px; background: #fafafa; cursor: crosshair; touch-action: none; }
#practice-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; font-size: 15em; color: rgba(0, 0, 0, 0.1); pointer-events: none; }
.vla-practice-controls { display: flex; justify-content: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}