
:root {
    --primary: #FFB7B2; --secondary: #E2F0CB; --accent: #B5EAD7; --accent2: #C7CEEA;
    --text-main: #5C5C5C; --bg-color: #FAFAFA; --card-bg: #FFFFFF;
}
* { box-sizing: border-box; font-family: 'Nunito', sans-serif; touch-action: manipulation; }
body { margin: 0; background-color: var(--bg-color); color: var(--text-main); overflow-x: hidden; }

/* Nav */
header {
    background: var(--primary); color: white; padding: 15px 20px;
    display: flex; justify-content: space-between; align-items: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05); position: sticky; top: 0; z-index: 100;
}
header.hidden { display: none; }
h1, h2, h3 { margin: 0; }
.nav-btn {
    background: rgba(255,255,255,0.3); border: none; padding: 8px 12px;
    border-radius: 15px; color: white; font-weight: bold; cursor: pointer; margin-left: 5px;
}
.logout-btn { display: none; } /* Đã chuyển chức năng logout vào Avatar Modal */

/* Screens */
.screen { display: none; padding: 20px; max-width: 800px; margin: 0 auto; text-align: center; animation: fadeIn 0.4s ease; }
.screen.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Login Box & Auth Buttons */
.login-box {
    background: white; padding: 30px 20px; border-radius: 20px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.05); max-width: 400px; margin: 20px auto; border: 3px solid var(--accent);
}
.cat-paw-icon { font-size: 40px; margin-bottom: 5px; }
.google-btn { background: #DB4437; width: 100%; box-shadow: 0 5px 0 #C13529 !important; margin-top:10px; }
.login-box input[type="text"], .login-box input[type="password"] {
    width: 100%; padding: 12px; margin: 10px 0 20px 0; border: 2px solid #ccc;
    border-radius: 12px; font-size: 16px; font-weight: bold; text-align: center;
}

/* Modal Quản Lý Tài Khoản */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-content { background: white; padding: 25px; border-radius: 20px; width: 90%; max-width: 400px; text-align: center; box-shadow: 0 10px 25px rgba(0,0,0,0.2); }
.modal-content input { width: 100%; padding: 12px; margin: 10px 0; border: 2px solid #ccc; border-radius: 12px; font-size: 16px; font-weight: bold; text-align: center; }

/* Dashboard */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 15px; margin-top: 20px; }
.stat-card { background: white; padding: 20px; border-radius: 15px; border: 2px solid var(--accent2); box-shadow: 0 4px 0 var(--accent2); }
.stat-value { font-size: 32px; font-weight: 800; color: var(--primary); margin-top: 10px; }

/* Grid & Cards */
.grid-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 20px; margin-top: 30px; }
.card-btn {
    background: var(--card-bg); border: 3px solid transparent; border-radius: 20px;
    padding: 30px 15px; font-size: 18px; font-weight: 800; color: var(--text-main);
    cursor: pointer; box-shadow: 0 8px 0 rgba(0,0,0,0.05); transition: all 0.2s; text-transform: uppercase;
}
.card-btn:active { transform: translateY(8px); box-shadow: 0 0 0 rgba(0,0,0,0.05); }

/* Colors */
.level-starter, .level-flyer { border-color: #FFDAC1; background: #FFDAC1; }
.level-a1, .level-a2 { border-color: #B5EAD7; background: #B5EAD7; }
.level-b1, .level-b2 { border-color: #C7CEEA; background: #C7CEEA; }
.level-c1, .level-c2 { border-color: #FF9AA2; background: #FF9AA2; color:white; }
.level-hsg { border-color: #F6E27F; background: #F6E27F; }
.vocab-bg { background: #FF9AA2; color: white; }
.scramble-bg { background: #FFB7B2; color: white; }
.reading-bg { background: #FFDAC1; color: #5C5C5C; }
.game-bg { background: #E2F0CB; color: #5C5C5C; }

/* Buttons & Progress */
.progress-bar { width: 100%; height: 10px; background: #eee; border-radius: 5px; margin-bottom: 20px; overflow: hidden; }
#progress-fill, #flashcard-progress-fill { height: 100%; background: var(--accent); width: 0%; transition: width 0.3s; }
.action-btn {
    padding: 12px 25px; font-size: 16px; font-weight: bold; border: none;
    border-radius: 12px; background: var(--primary); color: white; cursor: pointer;
    box-shadow: 0 5px 0 #E58C87; margin: 10px 0;
}
.action-btn:active { transform: translateY(5px); box-shadow: 0 0 0 #E58C87 !important; }
.hidden { display: none !important; }

/* Scramble */
.word-pool, .drop-zone {
    display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
    margin: 20px 0; min-height: 50px; padding: 15px; background: white;
    border-radius: 15px; border: 2px dashed #ccc;
}
.word-piece {
    background: var(--card-bg); border: 2px solid var(--accent); padding: 10px 15px;
    border-radius: 10px; font-weight: bold; cursor: pointer; user-select: none;
}

/* Reading */
.reading-passage { background: white; padding: 20px; border-radius: 15px; text-align: left; font-size: 16px; line-height: 1.6; margin-bottom: 20px; border: 2px solid #eee; }
.options-grid { display: flex; flex-direction: column; gap: 10px; }
.option-btn { padding: 15px; background: white; border: 2px solid #ddd; border-radius: 10px; font-size: 16px; cursor: pointer; text-align: left; }
.option-btn.selected { border-color: var(--accent); background: #E2F0CB; }

/* Grammar */
.grammar-card { background: white; border: 2px solid var(--accent2); border-radius: 15px; padding: 20px; font-weight: bold; cursor: pointer; box-shadow: 0 4px 0 var(--accent2); transition: transform 0.2s; }
.grammar-card:active { transform: translateY(4px); box-shadow: 0 0 0 var(--accent2); }
.theory-box { border: 2px dashed var(--accent); }
.theory-img { max-width: 100%; border-radius: 10px; margin: 15px 0; box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
.theory-tip { background: #FFF4E6; border-left: 5px solid #FFB7B2; padding: 10px; margin: 15px 0; border-radius: 5px; font-weight: bold; text-align: left; }

/* Feedback */
#feedback-msg { font-size: 20px; font-weight: bold; margin-top: 15px; }
.correct-text { color: #50C878; }
.wrong-text { color: #FF6B6B; }

/* Flashcard */
.flashcard {
    background-color: transparent; width: 100%; max-width: 400px; height: 250px;
    perspective: 1000px; margin: 20px auto; cursor: pointer;
}
.fc-inner {
    position: relative; width: 100%; height: 100%; text-align: center;
    transition: transform 0.6s; transform-style: preserve-3d;
}
.flashcard.is-flipped .fc-inner { transform: rotateY(180deg); }
.fc-front, .fc-back {
    position: absolute; width: 100%; height: 100%; backface-visibility: hidden;
    display: flex; align-items: center; justify-content: center; font-size: 28px;
    font-weight: bold; border-radius: 20px; box-shadow: 0 8px 15px rgba(0,0,0,0.1);
    padding: 20px;
}
.fc-front { background-color: #fff; color: var(--text-main); border: 4px solid var(--primary); }
.fc-back { background-color: var(--primary); color: white; transform: rotateY(180deg); }
