/* ========== RESET & VARIABLES ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --accent-color: #FF6B8B;
    --success-color: #2ecc71;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --info-color: #3498db;
    --light-color: #ffffff;
    --dark-color: #2c3e50;
    --game-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card-bg: rgba(255, 255, 255, 0.95);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    --border-radius: 20px;
    --neon-cyan: #00f5ff;
    --neon-pink: #ff0080;
    --neon-dark: #050510;
}

body {
    font-family: 'Comic Neue', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--game-bg);
    color: var(--dark-color);
    min-height: 100vh;
    position: relative;
}

/* ========== PARTICLES ========== */
#particles { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: -1; }
.particle  { position: fixed; background: rgba(255,255,255,0.2); border-radius: 50%; pointer-events: none; z-index: -1; animation: float linear infinite; }
@keyframes float { 0% { transform: translateY(0) rotate(0deg); } 100% { transform: translateY(-100vh) rotate(360deg); } }

/* ========== HEADER ========== */
.app-header {
    text-align: center; padding: 30px 20px;
    background: rgba(255,255,255,0.1); backdrop-filter: blur(10px);
    border-bottom: 2px solid rgba(255,255,255,0.2);
    margin-bottom: 30px; position: relative; overflow: hidden;
}
.app-header::before {
    content: ''; position: absolute; top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}
@keyframes rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.app-header h1 {
    font-size: 4rem; margin-bottom: 10px;
    text-shadow: 3px 3px 0 rgba(0,0,0,0.2);
    background: linear-gradient(135deg, #FFD700, #FF6B8B, #667eea);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    animation: glow 2s ease-in-out infinite alternate;
    position: relative; display: inline-block;
}
@keyframes glow {
    from { filter: drop-shadow(0 0 10px #FFD700) drop-shadow(0 0 20px #FF6B8B); }
    to   { filter: drop-shadow(0 0 20px #667eea) drop-shadow(0 0 40px #FFD700); }
}
.app-header p         { font-size: 1.3rem; color: white; text-shadow: 1px 1px 2px rgba(0,0,0,0.3); position: relative; }
.app-header .subtitle { font-size: 1.1rem; opacity: 0.9; margin-top: 5px; }

/* ========== MAIN CONTAINER ========== */
.main-container { max-width: 1400px; margin: 0 auto; padding: 0 20px; display: flex; gap: 30px; }

/* =====================================================
   QUESTION SECTION — giữ nguyên giao diện gốc bắt mắt
   ===================================================== */
.question-section {
    flex: 1;
    background: var(--card-bg);
    border-radius: 30px;
    padding: 18px 20px;
    box-shadow: 0 14px 30px rgba(0,0,0,0.18);
    backdrop-filter: blur(10px);
    border: 3px solid transparent;
    background-clip: padding-box;
    position: sticky;
    top: 10px;
    height: fit-content;
    overflow: hidden;
}
.question-section::before {
    content: ''; position: absolute; top: -2px; left: -2px; right: -2px; bottom: -2px;
    background: linear-gradient(135deg, #FFD700, #FF6B8B, #667eea);
    border-radius: 42px; z-index: -1; animation: borderRotate 3s linear infinite;
}
@keyframes borderRotate { 0% { filter: hue-rotate(0deg); } 100% { filter: hue-rotate(360deg); } }

.question-section h2 {
    color: var(--dark-color); margin-bottom: 12px; padding-bottom: 8px;
    border-bottom: 2px solid var(--info-color); font-size: 1.15rem; text-align: center;
}

/* ── Diamond Display ── */
.diamond-display {
    background: linear-gradient(135deg, #2c3e50, #34495e); border-radius: 50px;
    padding: 10px 20px; margin-bottom: 12px; display: flex; align-items: center; gap: 14px;
    border: 2px solid #FFD700; box-shadow: 0 6px 18px rgba(255,215,0,0.25);
    position: relative; overflow: hidden;
}
.diamond-display::before { content: '💎'; position: absolute; right: 14px; font-size: 2.5rem; opacity: 0.1; animation: rotate 10s linear infinite; }
.diamond-icon { width: 34px; height: 34px; background: linear-gradient(135deg, #FFD700, #FFA500); clip-path: polygon(50% 0%,100% 50%,50% 100%,0% 50%); animation: spin 4s linear infinite; filter: drop-shadow(0 0 8px gold); }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.diamond-count { font-size: 1.8rem; font-weight: bold; color: #FFD700; text-shadow: 2px 2px 4px rgba(0,0,0,0.3); line-height: 1; }
.diamond-label { font-size: 0.85rem; color: white; margin-left: auto; background: rgba(255,255,255,0.2); padding: 5px 12px; border-radius: 30px; }

/* ── Question Filters ── */
.question-filters {
    background: white; border-radius: 14px; padding: 10px 14px; margin-bottom: 10px;
    display: flex; flex-direction: column; gap: 8px;
    border: 2px solid #FFD700; box-shadow: 0 3px 10px rgba(255,215,0,0.15);
}
.filter-row {
    display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
}
.filter-group { display: flex; align-items: center; gap: 7px; flex: 1; min-width: 150px; }
.filter-group-full { flex: 1; min-width: 100%; }
.filter-group label { font-weight: bold; color: var(--dark-color); white-space: nowrap; font-size: 0.85rem; }
.filter-group select {
    flex: 1; padding: 6px 10px; border-radius: 10px; border: 2px solid #e0e7ff;
    font-size: 0.85rem; cursor: pointer; background: white; transition: all 0.3s;
    font-family: 'Comic Neue', sans-serif;
}
.filter-group select:hover { border-color: var(--info-color); transform: translateY(-1px); box-shadow: 0 3px 10px rgba(52,152,219,0.15); }
.filter-stats {
    padding: 5px 14px; background: linear-gradient(135deg, #667eea, #764ba2);
    color: white; border-radius: 30px; font-weight: bold; white-space: nowrap;
    font-size: 0.8rem; box-shadow: 0 3px 10px rgba(102,126,234,0.25);
}
/* Chapter row */
#chapterRow {
    border-top: 1px dashed #e0e7ff; padding-top: 8px;
    animation: slideIn 0.25s ease;
}
#chapterFilter {
    border-color: #e67e22 !important; font-weight: 700; color: #7d3c00;
    background: linear-gradient(135deg, #fff8f0, #fff) !important;
}
/* Lesson row */
#lessonRow {
    border-top: 1px dashed #e0e7ff; padding-top: 8px;
    animation: slideIn 0.25s ease;
}
#lessonFilter {
    border-color: #667eea !important; font-weight: 600; color: #2c3e50;
    background: linear-gradient(135deg, #f0f4ff, #fff) !important;
}

/* ── Question Controls ── */
.question-controls { margin-bottom: 10px; text-align: right; }
.new-question-btn {
    background: linear-gradient(135deg, #667eea, #764ba2); color: white; border: none;
    border-radius: 50px; padding: 9px 22px; font-size: 0.92rem; cursor: pointer;
    transition: all 0.3s; display: inline-flex; align-items: center; gap: 8px;
    font-weight: bold; box-shadow: 0 6px 18px rgba(102,126,234,0.35);
    position: relative; overflow: hidden;
}
.new-question-btn::before {
    content: ''; position: absolute; top: -20px; left: -20px;
    width: 60px; height: 60px; background: rgba(255,255,255,0.2);
    border-radius: 50%; animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100% { transform: scale(1); opacity: 0.3; } 50% { transform: scale(1.5); opacity: 0.1; } }
.new-question-btn:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 14px 28px rgba(102,126,234,0.55); }

/* ── Question Container ── */
.question-container {
    background: #f8f9fa; padding: 16px 18px; border-radius: 16px; margin-bottom: 10px;
    border: 2px solid var(--info-color); position: relative; min-height: 0;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.04);
}
.question-container::before { content: '❓'; position: absolute; top: -10px; right: -10px; font-size: 3.5rem; opacity: 0.08; transform: rotate(15deg); }

.no-question { text-align: center; padding: 28px 16px; color: #666; }
.no-question p { margin-bottom: 12px; font-size: 1rem; }
.hint { font-size: 0.88rem; color: var(--info-color); background: rgba(52,152,219,0.1); padding: 10px 12px; border-radius: 10px; border-left: 3px solid var(--info-color); margin: 10px 0; text-align: left; }

.question-category { background: linear-gradient(135deg, var(--info-color), #2980b9); color: white; padding: 5px 14px; border-radius: 30px; display: inline-block; margin-bottom: 10px; font-size: 0.82rem; font-weight: bold; box-shadow: 0 2px 8px rgba(52,152,219,0.25); }
.question-container h3 { font-size: 1.05rem; margin-bottom: 12px; color: var(--dark-color); line-height: 1.5; }
.answers-grid { display: grid; grid-template-columns: 1fr; gap: 8px; margin: 10px 0; }

.answer-btn {
    padding: 11px 14px; background: white; border: 2px solid #e0e7ff; border-radius: 12px;
    cursor: pointer; transition: all 0.3s; text-align: left; font-size: 0.92rem;
    font-weight: 500; position: relative; overflow: hidden;
}
.answer-btn::before { content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent); transition: left 0.5s; }
.answer-btn:hover::before { left: 100%; }
.answer-btn:hover  { border-color: #3498db; transform: translateX(4px); box-shadow: 0 4px 14px rgba(52,152,219,0.18); }
.answer-btn.selected  { background: #3498db !important; color: white !important; border-color: #2980b9 !important; }
.answer-btn.correct   { background: #2ecc71 !important; color: white !important; border-color: #27ae60 !important; animation: correctPulse 0.5s; }
.answer-btn.incorrect { background: #e74c3c !important; color: white !important; border-color: #c0392b !important; animation: shake 0.5s; }
@keyframes correctPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

.submit-btn {
    width: 100%; padding: 11px; background: linear-gradient(135deg, var(--success-color), #27ae60);
    color: white; border: none; border-radius: 12px; font-size: 1rem; font-weight: bold;
    cursor: pointer; transition: all 0.3s; margin-top: 10px; position: relative; overflow: hidden;
}
.submit-btn::before { content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent); transition: left 0.5s; }
.submit-btn:hover:not(:disabled)::before { left: 100%; }
.submit-btn:disabled { background: #bdc3c7; cursor: not-allowed; }
.submit-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(46,204,113,0.35); }

.feedback { padding: 12px 14px; border-radius: 12px; margin-top: 10px; animation: slideIn 0.5s ease; font-size: 0.9rem; }
.correct-feedback   { background: #d4edda; color: #155724; border: 2px solid #c3e6cb; }
.incorrect-feedback { background: #f8d7da; color: #721c24; border: 2px solid #f5c6cb; }
.resource-gain { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: rgba(255,215,0,0.2); border-radius: 8px; margin: 8px 0; font-weight: bold; font-size: 1rem; }
@keyframes slideIn { from { transform: translateY(-12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── Stats Summary ── */
.stats-summary { background: linear-gradient(135deg, #f8f9fa, #e9ecef); border-radius: 14px; padding: 12px 14px; margin-top: 10px; }
.stats-summary h3 { margin-bottom: 10px; color: var(--dark-color); font-size: 0.95rem; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat-item  { display: flex; align-items: center; gap: 6px; padding: 8px 10px; background: white; border-radius: 10px; border-left: 3px solid var(--success-color); box-shadow: 0 2px 6px rgba(0,0,0,0.05); }
.stat-icon  { font-size: 1rem; }
.stat-label { font-size: 0.78rem; color: #666; }
.stat-value { font-weight: bold; color: var(--dark-color); margin-left: auto; font-size: 1rem; }

/* =====================================================
   GAMES SECTION
   ===================================================== */
.games-section { flex: 1; }

.games-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 15px; }
.games-section-header h2 { color: white; font-size: 2rem; text-shadow: 2px 2px 4px rgba(0,0,0,0.3); margin: 0; }

/* ── Game Filter Tabs ── */
.game-filter-tabs { display: flex; gap: 10px; flex-wrap: wrap; }
.gf-tab {
    padding: 10px 22px; border: 2px solid rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.15); color: white; border-radius: 30px;
    font-size: 0.95rem; font-weight: bold; cursor: pointer; transition: all 0.3s;
    backdrop-filter: blur(5px); font-family: 'Comic Neue', sans-serif;
}
.gf-tab:hover  { background: rgba(255,255,255,0.3); transform: translateY(-2px); }
.gf-tab.active { background: white; color: #667eea; border-color: white; box-shadow: 0 5px 20px rgba(255,255,255,0.4); }

/* ── Game Icon Grid ── */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

/* ── Game Icon Card ── */
.game-icon-card {
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
    gap: 8px;
    background: rgba(255,255,255,0.92);
    border-radius: 22px;
    padding: 16px 10px 14px;
    cursor: pointer;
    border: 3px solid transparent;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative; overflow: hidden;
    user-select: none;
}
.game-icon-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
    background: linear-gradient(90deg, #FFD700, #FF6B8B, #667eea);
    animation: borderRotate 3s linear infinite;
}
.game-icon-card:hover {
    transform: translateY(-8px) scale(1.06);
    border-color: #FFD700;
    box-shadow: 0 20px 40px rgba(255,215,0,0.35), 0 8px 24px rgba(0,0,0,0.2);
}
.game-icon-card:active { transform: scale(0.96); }

/* Neon variant */
.game-icon-card.neon-card {
    background: var(--neon-dark);
    border-color: rgba(0,245,255,0.2);
    box-shadow: 0 0 20px rgba(0,245,255,0.08), 0 8px 24px rgba(0,0,0,0.5);
}
.game-icon-card.neon-card::before {
    background: linear-gradient(90deg, transparent, var(--neon-cyan), var(--neon-pink), transparent);
    height: 2px; animation: neonTopLine 3s linear infinite;
}
.game-icon-card.neon-card:hover {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 35px rgba(0,245,255,0.2), 0 20px 40px rgba(0,0,0,0.6);
}
@keyframes neonTopLine { 0% { filter: hue-rotate(0deg); } 100% { filter: hue-rotate(360deg); } }

/* NEW badge trên icon card */
.game-icon-card .new-tag {
    position: absolute; top: 7px; right: 7px;
    background: #FFD700; color: #2c3e50;
    font-size: 0.55rem; font-weight: 900;
    padding: 2px 7px; border-radius: 30px;
    letter-spacing: 1px; text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(255,215,0,0.5);
    animation: badgeWiggle 1.5s ease-in-out infinite;
}
.game-icon-card.neon-card .new-tag {
    background: var(--neon-cyan); color: var(--neon-dark);
    font-family: 'Orbitron', sans-serif; font-size: 0.5rem; letter-spacing: 2px;
    box-shadow: 0 0 8px rgba(0,245,255,0.5);
}

/* Icon background circle */
.game-icon-bg {
    width: 60px; height: 60px; border-radius: 18px;
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem; flex-shrink: 0;
    box-shadow: 0 6px 18px rgba(0,0,0,0.22);
    transition: transform 0.3s;
}
.game-icon-card:hover .game-icon-bg { transform: scale(1.12) rotate(-5deg); }

.game-icon-name {
    font-size: 0.72rem; font-weight: 800;
    text-align: center; color: var(--dark-color);
    line-height: 1.3; max-width: 96px;
}
.neon-card .game-icon-name {
    color: rgba(0,245,255,0.9);
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.65rem; letter-spacing: 0.5px;
}

.game-icon-diff {
    font-size: 0.65rem; color: #888;
    text-align: center; font-weight: 600;
}
.neon-card .game-icon-diff { color: rgba(0,245,255,0.45); }

/* Mini progress bar on icon card */
.game-icon-card .icon-progress-track {
    width: 100%; height: 4px;
    background: rgba(0,0,0,0.1); border-radius: 50px; overflow: hidden; margin-top: 2px;
}
.neon-card .icon-progress-track { background: rgba(0,245,255,0.08); }
.game-icon-card .icon-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #FFD700, #FF6B8B);
    border-radius: 50px; transition: width 0.4s ease;
}
.neon-card .icon-progress-fill {
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-pink));
    box-shadow: 0 0 6px rgba(0,245,255,0.4);
}
.game-icon-card .icon-progress-label {
    font-size: 0.58rem; color: #aaa; text-align: right; width: 100%;
    margin-top: 1px;
}
.neon-card .icon-progress-label { color: rgba(0,245,255,0.35); }

/* Game note footer */
.game-note {
    background: rgba(255,255,255,0.2); border-radius: 20px; padding: 16px 20px;
    color: white; text-align: center; font-size: 0.95rem;
    backdrop-filter: blur(5px); border: 2px solid rgba(255,255,255,0.3);
}
.game-note p { margin: 6px 0; }

/* =====================================================
   UPGRADE MODAL (popup khi bấm vào game icon)
   ===================================================== */
.upgrade-modal {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(0,0,0,0.65); backdrop-filter: blur(8px);
    display: none; align-items: center; justify-content: center;
    animation: fadeIn 0.25s ease;
}

.upgrade-modal-content {
    background: white;
    border-radius: 30px;
    width: min(500px, 95vw);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 30px 60px rgba(0,0,0,0.4);
    border: 3px solid #FFD700;
    animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    scrollbar-width: thin;
}
.upgrade-modal-content::-webkit-scrollbar { width: 6px; }
.upgrade-modal-content::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 3px; }
.upgrade-modal-content::-webkit-scrollbar-thumb { background: #667eea; border-radius: 3px; }

/* Modal header */
.um-header {
    padding: 22px 24px 16px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 27px 27px 0 0;
    display: flex; align-items: center; gap: 16px;
    color: white;
    position: relative;
}
.um-icon {
    flex-shrink: 0;
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}
.um-title {
    font-family: 'Orbitron', 'Comic Neue', sans-serif;
    font-size: 1.15rem; font-weight: 900; letter-spacing: 1px;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
}
.um-sub {
    font-size: 0.85rem; opacity: 0.85; margin-top: 3px;
    background: rgba(255,255,255,0.2); display: inline-block;
    padding: 3px 10px; border-radius: 20px; margin-top: 5px;
}
.um-close {
    margin-left: auto; background: rgba(255,255,255,0.2); border: 2px solid rgba(255,255,255,0.4);
    color: white; font-size: 1.4rem; cursor: pointer; line-height: 1;
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; flex-shrink: 0;
}
.um-close:hover { background: rgba(255,255,255,0.35); transform: scale(1.1); }

/* Modal diamond bar */
.um-diamonds {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 24px;
    background: linear-gradient(135deg, #2c3e50, #34495e);
    border-bottom: 3px solid #FFD700;
}
.um-diamonds .diamond-icon-small { width: 24px; height: 24px; }
.um-diamonds span {
    font-size: 1.6rem; font-weight: 900; color: #FFD700;
    text-shadow: 0 0 10px rgba(255,215,0,0.5);
    font-family: 'Orbitron', sans-serif;
}
.um-diamonds small { color: rgba(255,255,255,0.6); font-size: 0.8rem; }

/* Modal upgrades list */
.um-upgrades { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }

.um-upgrade-item {
    display: flex; align-items: center; gap: 12px;
    background: white; border: 2px solid #e0e7ff;
    border-radius: 18px; padding: 14px 16px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.06);
    position: relative; overflow: hidden;
    transition: all 0.25s;
}
.um-upgrade-item::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    border-radius: 5px 0 0 5px;
}
.um-upgrade-item:hover { border-color: #FFD700; box-shadow: 0 8px 24px rgba(255,215,0,0.2); transform: translateX(-3px); }
.um-upgrade-item.maxed { background: linear-gradient(135deg, #2c3e50, #34495e); border-color: #FFD700; }
.um-upgrade-item.maxed .um-upgrade-name { color: white; }
.um-upgrade-item.maxed .um-upgrade-desc { color: rgba(255,255,255,0.65); }

.um-u-icon {
    font-size: 1.8rem; flex-shrink: 0;
    width: 48px; height: 48px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 14px; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(102,126,234,0.4);
    animation: iconPulse 2s infinite;
}
.um-upgrade-item.maxed .um-u-icon {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    box-shadow: 0 4px 12px rgba(255,215,0,0.5);
}

.um-upgrade-info { flex: 1; min-width: 0; }
.um-upgrade-name { font-weight: 800; font-size: 1rem; color: var(--dark-color); display: block; margin-bottom: 2px; }
.um-upgrade-desc { font-size: 0.8rem; color: #888; display: block; margin-bottom: 7px; }

.um-progress { display: flex; align-items: center; gap: 8px; }
.um-progress-track {
    flex: 1; height: 7px;
    background: #e8e8e8; border-radius: 50px; overflow: hidden;
}
.um-progress-fill {
    height: 100%; border-radius: 50px;
    background: linear-gradient(90deg, #FFD700, #FF6B8B);
    transition: width 0.4s ease;
    animation: progressGlow 2s infinite;
}
.um-progress-label { font-size: 0.72rem; font-weight: 800; color: #555; white-space: nowrap; }

/* Neon upgrade item inside modal */
.um-upgrade-item.neon-um {
    background: rgba(0,245,255,0.04);
    border-color: rgba(0,245,255,0.2);
    border-radius: 10px;
}
.um-upgrade-item.neon-um::before { background: linear-gradient(135deg, var(--neon-cyan), var(--neon-pink)); }
.um-upgrade-item.neon-um:hover { border-color: rgba(0,245,255,0.4); box-shadow: 0 0 18px rgba(0,245,255,0.1); }
.um-upgrade-item.neon-um .um-upgrade-name { color: rgba(0,245,255,0.9); font-family: 'Share Tech Mono', monospace; }
.um-upgrade-item.neon-um .um-upgrade-desc { color: rgba(0,245,255,0.4); }
.um-upgrade-item.neon-um .um-u-icon { background: transparent; border: 1px solid rgba(0,245,255,0.3); box-shadow: 0 0 12px rgba(0,245,255,0.15); }
.um-upgrade-item.neon-um .um-progress-track { background: rgba(0,245,255,0.08); }
.um-upgrade-item.neon-um .um-progress-fill { background: linear-gradient(90deg, var(--neon-cyan), var(--neon-pink)); box-shadow: 0 0 6px rgba(0,245,255,0.4); animation: none; }
.um-upgrade-item.neon-um .um-progress-label { color: rgba(0,245,255,0.5); }

.um-upgrade-btn {
    padding: 10px 16px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none; border-radius: 14px;
    color: white; font-family: 'Comic Neue', sans-serif; font-weight: 800; font-size: 0.85rem;
    cursor: pointer; white-space: nowrap;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    min-width: 84px;
    box-shadow: 0 5px 15px rgba(102,126,234,0.4);
    transition: all 0.25s; position: relative; overflow: hidden;
}
.um-upgrade-btn::before {
    content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    transition: left 0.4s;
}
.um-upgrade-btn:hover:not(:disabled)::before { left: 100%; }
.um-upgrade-btn:hover:not(:disabled) { transform: translateY(-3px) scale(1.05); box-shadow: 0 10px 25px rgba(102,126,234,0.55); }
.um-upgrade-btn:disabled { background: linear-gradient(135deg, #95a5a6, #7f8c8d); cursor: not-allowed; opacity: 0.75; }
.um-upgrade-btn.max-btn-um { background: linear-gradient(135deg, #FFD700, #FFA500); color: #2c3e50; box-shadow: 0 5px 15px rgba(255,215,0,0.4); }
.um-upgrade-btn .cost { font-size: 0.72rem; opacity: 0.9; font-weight: 700; }

/* Neon upgrade btn */
.um-upgrade-item.neon-um .um-upgrade-btn {
    background: transparent; border: 1px solid rgba(0,245,255,0.4);
    color: var(--neon-cyan); font-family: 'Share Tech Mono', monospace;
    font-size: 0.72rem; letter-spacing: 1px; border-radius: 5px;
    box-shadow: 0 0 10px rgba(0,245,255,0.1);
}
.um-upgrade-item.neon-um .um-upgrade-btn:hover:not(:disabled) {
    background: var(--neon-cyan); color: var(--neon-dark);
    box-shadow: 0 0 22px rgba(0,245,255,0.4); transform: translateY(-2px) scale(1.04);
}

/* MAX badge inside modal */
.max-badge-um {
    position: absolute; top: 7px; right: 10px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #2c3e50; font-size: 0.65rem; font-weight: 900;
    padding: 2px 10px; border-radius: 30px; letter-spacing: 1px;
    box-shadow: 0 3px 10px rgba(255,215,0,0.4);
    animation: badgeWiggle 1.5s ease-in-out infinite;
}
.um-upgrade-item.neon-um .max-badge-um {
    background: var(--neon-cyan); color: var(--neon-dark);
    font-family: 'Orbitron', sans-serif; font-size: 0.55rem; letter-spacing: 2px;
    border-radius: 3px; box-shadow: 0 0 10px rgba(0,245,255,0.5);
}

/* Modal play button */
.um-play-btn {
    display: block; margin: 4px 20px 22px;
    width: calc(100% - 40px); padding: 18px;
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    border: none; border-radius: 15px;
    color: white; font-family: 'Comic Neue', sans-serif; font-weight: 800; font-size: 1.15rem;
    cursor: pointer; letter-spacing: 1px; text-align: center;
    box-shadow: 0 10px 25px rgba(46,204,113,0.4);
    transition: all 0.3s; position: relative; overflow: hidden;
}
.um-play-btn::before {
    content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    opacity: 0; transition: opacity 0.4s;
}
.um-play-btn:hover { transform: translateY(-5px) scale(1.02); box-shadow: 0 20px 35px rgba(46,204,113,0.55); }
.um-play-btn:hover::before { opacity: 1; }

/* Neon play in modal */
.um-play-btn.neon-play {
    background: transparent; border: 2px solid var(--neon-cyan); color: var(--neon-cyan);
    font-family: 'Orbitron', sans-serif; letter-spacing: 4px; font-size: 1rem;
    box-shadow: 0 0 18px rgba(0,245,255,0.18); border-radius: 5px;
}
.um-play-btn.neon-play::before { display: none; }
.um-play-btn.neon-play:hover {
    background: var(--neon-cyan); color: var(--neon-dark);
    box-shadow: 0 0 35px rgba(0,245,255,0.45), 0 10px 20px rgba(0,0,0,0.4);
}

/* =====================================================
   COMMON REUSED ATOMS
   ===================================================== */
.diamond-icon-small {
    width: 18px; height: 18px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    clip-path: polygon(50% 0%,100% 50%,50% 100%,0% 50%);
    animation: spinSmall 3s linear infinite; flex-shrink: 0;
}
@keyframes spinSmall { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes iconPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes badgeWiggle { 0%,100% { transform: rotate(10deg); } 50% { transform: rotate(16deg); } }
@keyframes progressGlow { 0%,100% { opacity: 1; } 50% { opacity: 0.8; box-shadow: 0 0 10px #FFD700; } }

/* =====================================================
   AUTH / LOGIN MODAL — giữ nguyên giao diện gốc
   ===================================================== */
.login-btn {
    position: fixed; top: 20px; right: 20px;
    background: linear-gradient(135deg, #667eea, #764ba2); color: white;
    border: 2px solid #FFD700; border-radius: 50px; padding: 12px 25px;
    font-size: 1rem; font-weight: bold; cursor: pointer;
    display: flex; align-items: center; gap: 10px;
    z-index: 1000; box-shadow: 0 5px 20px rgba(102,126,234,0.4); transition: all 0.3s;
}
.login-btn:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 10px 30px rgba(255,215,0,0.5); }
.login-icon { font-size: 1.2rem; }

/* Method tabs (username / phone) */
.method-tabs {
    display: flex; gap: 0;
    background: #f0f0f0; border-radius: 12px; padding: 4px; margin-bottom: 20px;
}
.method-btn {
    flex: 1; padding: 9px 6px; background: none; border: none;
    border-radius: 9px; color: #888; font-family: 'Comic Neue', sans-serif;
    font-weight: 700; font-size: 0.85rem; cursor: pointer; transition: all 0.2s;
}
.method-btn.active { background: linear-gradient(135deg, #667eea, #764ba2); color: white; box-shadow: 0 3px 10px rgba(102,126,234,0.35); }

/* Phone row */
.phone-row { display: flex; gap: 8px; }
.phone-prefix {
    width: 64px; flex-shrink: 0; text-align: center;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: 2px solid #e0e0e0; border-radius: 10px;
    color: white; font-weight: 800; font-size: 0.95rem; padding: 12px 0;
    display: flex; align-items: center; justify-content: center;
}

.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(5px);
    display: flex; justify-content: center; align-items: center;
    z-index: 2000; animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
    background: white; border-radius: 30px;
    width: 90%; max-width: 450px; max-height: 90vh; overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    animation: slideUp 0.3s ease; border: 3px solid #FFD700;
}
@keyframes slideUp { from { transform: translateY(50px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header {
    padding: 20px 30px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white; border-radius: 27px 27px 0 0;
    display: flex; justify-content: space-between; align-items: center;
}
.modal-header h2 { margin: 0; font-size: 1.5rem; }
.close-btn { background: none; border: none; color: white; font-size: 2rem; cursor: pointer; line-height: 1; padding: 0 10px; transition: transform 0.3s; }
.close-btn:hover { transform: scale(1.2); }

.auth-tabs { display: flex; padding: 20px 20px 0; gap: 10px; }
.tab-btn {
    flex: 1; padding: 12px; border: none; background: #f0f0f0;
    color: #666; font-size: 1rem; font-weight: bold;
    border-radius: 10px 10px 0 0; cursor: pointer; transition: all 0.3s;
}
.tab-btn.active { background: linear-gradient(135deg, #667eea, #764ba2); color: white; }

#loginForm, #registerForm { padding: 24px 30px 30px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; margin-bottom: 7px; font-weight: bold; color: #333; }
.form-group input {
    width: 100%; padding: 12px 15px; border: 2px solid #e0e0e0;
    border-radius: 10px; font-size: 1rem; transition: all 0.3s;
    box-sizing: border-box; font-family: 'Comic Neue', sans-serif;
}
.form-group input:focus { outline: none; border-color: #667eea; box-shadow: 0 0 0 3px rgba(102,126,234,0.12); }

.auth-submit-btn {
    width: 100%; padding: 15px;
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: white; border: none; border-radius: 10px;
    font-size: 1.1rem; font-weight: bold; cursor: pointer;
    transition: all 0.3s; margin: 10px 0 20px;
}
.auth-submit-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 25px rgba(46,204,113,0.4); }
.auth-footer { text-align: center; color: #666; }
.auth-footer a { color: #667eea; text-decoration: none; font-weight: bold; cursor: pointer; }
.auth-footer a:hover { text-decoration: underline; }

.user-panel {
    position: fixed; top: 20px; right: 20px;
    background: white; border-radius: 60px; padding: 8px 20px 8px 8px;
    display: flex; align-items: center; gap: 15px;
    z-index: 1000; box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    border: 2px solid #FFD700; animation: slideDown 0.3s ease;
}
@keyframes slideDown { from { transform: translateY(-100px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.user-avatar { width: 45px; height: 45px; background: linear-gradient(135deg, #667eea, #764ba2); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; color: white; border: 2px solid #FFD700; font-weight: 900; }
.user-name  { font-weight: bold; color: #333; font-size: 1rem; }
.user-email { font-size: 0.8rem; color: #666; }
.logout-btn { background: linear-gradient(135deg, #e74c3c, #c0392b); color: white; border: none; border-radius: 30px; padding: 8px 15px; font-size: 0.9rem; cursor: pointer; display: flex; align-items: center; gap: 5px; transition: all 0.3s; font-family: 'Comic Neue', sans-serif; font-weight: bold; }
.logout-btn:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(231,76,60,0.3); }

/* =====================================================
   UPGRADE FLASH & CONFETTI & NOTIFICATIONS
   ===================================================== */
.upgrade-flash { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 9999; animation: flashFadeOut 1s forwards; }
@keyframes flashFadeOut { 0% { opacity: 1; } 70% { opacity: 0.8; } 100% { opacity: 0; } }
.upgrade-glow { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 200px; height: 200px; background: radial-gradient(circle, rgba(255,215,0,0.8) 0%, rgba(255,215,0,0) 70%); border-radius: 50%; animation: glowPulse 0.5s ease-out; }
@keyframes glowPulse { 0% { transform: translate(-50%,-50%) scale(0.5); opacity: 1; } 100% { transform: translate(-50%,-50%) scale(2); opacity: 0; } }
.upgrade-text { position: absolute; top: 40%; left: 50%; transform: translate(-50%,-50%); color: #FFD700; font-size: 3rem; font-weight: bold; text-shadow: 2px 2px 4px rgba(0,0,0,0.5); animation: textFloat 0.8s ease-out; white-space: nowrap; }
.upgrade-level-text { position: absolute; top: 60%; left: 50%; transform: translate(-50%,-50%); color: white; font-size: 2rem; font-weight: bold; text-shadow: 0 0 20px #FFD700; animation: levelFloat 0.8s ease-out; white-space: nowrap; }
@keyframes textFloat  { 0% { transform: translate(-50%,-50%) scale(0.5); opacity: 0; } 50% { transform: translate(-50%,-60%) scale(1.2); opacity: 1; } 100% { transform: translate(-50%,-80%) scale(1); opacity: 0; } }
@keyframes levelFloat { 0% { transform: translate(-50%,-50%) scale(0.5); opacity: 0; } 50% { transform: translate(-50%,-40%) scale(1.2); opacity: 1; } 100% { transform: translate(-50%,-20%) scale(1); opacity: 0; } }

.confetti { position: fixed; width: 10px; height: 10px; background: #FFD700; top: -10px; z-index: 10000; animation: confettiFall 2s linear forwards; }
@keyframes confettiFall { 0% { transform: translateY(0) rotate(0deg); opacity: 1; } 100% { transform: translateY(100vh) rotate(720deg); opacity: 0; } }

.notification { position: fixed; top: 30px; right: 30px; padding: 15px 25px; border-radius: 50px; background: white; color: #2c3e50; font-weight: bold; box-shadow: 0 10px 30px rgba(0,0,0,0.2); z-index: 10000; transform: translateX(400px); transition: transform 0.3s ease; border-left: 5px solid; min-width: 280px; }
.notification.show { transform: translateX(0); }
.notification-success { border-left-color: #2ecc71; background: linear-gradient(135deg, #d4edda, #c3e6cb); }
.notification-error   { border-left-color: #e74c3c; background: linear-gradient(135deg, #f8d7da, #f5c6cb); }
.notification-warning { border-left-color: #f39c12; background: linear-gradient(135deg, #fff3cd, #ffeeba); }
.notification-info    { border-left-color: #3498db; background: linear-gradient(135deg, #d1ecf1, #bee5eb); }

/* =====================================================
   FOOTER
   ===================================================== */
.site-footer {
    margin-top: 50px;
    background: rgba(0,0,0,0.25);
    backdrop-filter: blur(14px);
    border-top: 1px solid rgba(255,255,255,0.12);
}

/* ── Stats bar ── */
.footer-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0;
    padding: 28px 40px;
    background: rgba(102,126,234,0.18);
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.footer-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 0 36px;
    flex: 1;
    min-width: 120px;
}

.footer-stat-divider {
    width: 1px;
    height: 48px;
    background: rgba(255,255,255,0.15);
    flex-shrink: 0;
}

.footer-stat-icon {
    font-size: 2rem;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3));
}

.footer-stat-num {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.6rem;
    font-weight: 900;
    color: #FFD700;
    text-shadow: 0 0 14px rgba(255,215,0,0.45);
    line-height: 1;
}

.footer-stat-label {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.65);
    letter-spacing: 0.5px;
    text-align: center;
}

/* ── Bottom bar ── */
.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    padding: 22px 40px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.footer-logo {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.3rem;
    font-weight: 900;
    background: linear-gradient(135deg, #FFD700, #FF6B8B, #667eea);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 2px;
}

.footer-tagline {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.5);
    letter-spacing: 0.5px;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255,255,255,0.6);
    font-size: 0.85rem;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-dot {
    opacity: 0.4;
}

.footer-contact {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

.footer-contact-label {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.45);
    letter-spacing: 0.3px;
}

.footer-email {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, rgba(102,126,234,0.3), rgba(118,75,162,0.3));
    border: 1px solid rgba(102,126,234,0.4);
    color: #a8b8ff;
    text-decoration: none;
    padding: 7px 16px;
    border-radius: 30px;
    font-size: 0.88rem;
    font-weight: 700;
    transition: all 0.25s;
    box-shadow: 0 2px 12px rgba(102,126,234,0.2);
}

.footer-email:hover {
    background: linear-gradient(135deg, rgba(102,126,234,0.55), rgba(118,75,162,0.55));
    border-color: rgba(168,184,255,0.7);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102,126,234,0.4);
}

/* ── Copyright ── */
.footer-copy {
    text-align: center;
    padding: 14px 20px;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.3);
    letter-spacing: 0.3px;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1024px) {
    .main-container { flex-direction: column; }
    .question-section { position: static; }
    .app-header h1 { font-size: 3rem; }
    .games-section-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 768px) {
    .app-header h1 { font-size: 2.5rem; }
    .app-header p  { font-size: 1rem; }
    .games-grid    { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 10px; }
    .game-icon-bg  { width: 50px; height: 50px; font-size: 1.7rem; }
    .question-filters { flex-direction: column; }
    .filter-row       { flex-direction: column; }
    .filter-group     { width: 100%; min-width: unset; }
    .filter-stats     { width: 100%; text-align: center; }
    .stats-grid    { grid-template-columns: 1fr; }
    .diamond-display { flex-wrap: wrap; }
    .diamond-label { margin-left: 0; width: 100%; text-align: center; }
    .login-btn, .user-panel { top: 10px; right: 10px; }
    .login-btn     { padding: 8px 15px; font-size: 0.9rem; }
    .user-panel    { padding: 5px 15px 5px 5px; }
    .user-avatar   { width: 35px; height: 35px; font-size: 1.1rem; }
    .modal-content { width: 95%; margin: 10px; }
    .gf-tab        { padding: 8px 14px; font-size: 0.85rem; }
    .game-filter-tabs { gap: 6px; }
    .upgrade-modal-content { border-radius: 20px; }
    .um-header { border-radius: 17px 17px 0 0; padding: 18px 18px 14px; }
    /* footer */
    .footer-stats   { padding: 20px 16px; gap: 0; }
    .footer-stat-item { padding: 0 14px; min-width: 80px; }
    .footer-stat-num  { font-size: 1.2rem; }
    .footer-stat-icon { font-size: 1.5rem; }
    .footer-bottom  { flex-direction: column; align-items: center; text-align: center; padding: 18px 20px; gap: 14px; }
    .footer-contact { align-items: center; }
    .footer-links   { justify-content: center; }
}

@media (max-width: 400px) {
    .games-grid { grid-template-columns: repeat(3, 1fr); }
}
/* ============================================================
   STYLES CHO 3 DẠNG CÂU HỎI MỚI
   ============================================================ */

/* Badge dạng câu hỏi */
.q-type-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin: 6px 0 4px;
}
.q-type-mc   { background: #e8f4fd; color: #2980b9; }
.q-type-calc { background: #fef9e7; color: #f39c12; }
.q-type-fb   { background: #eafaf1; color: #27ae60; }

/* Meta (tên bài) */
.q-meta {
    font-size: 0.78rem;
    color: #999;
    margin-bottom: 8px;
    font-style: italic;
}

/* ─── DẠNG 2: TÍNH TOÁN ─────────────────────────────────── */
.q-calc-question {
    font-size: 1rem;
    line-height: 1.6;
    color: #2c3e50;
    margin: 10px 0 12px;
    white-space: pre-wrap;
}

.given-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    background: #f8f9fa;
    border-radius: 10px;
    overflow: hidden;
}
.given-table td {
    padding: 7px 14px;
    font-size: 0.88rem;
    border-bottom: 1px solid #eee;
}
.given-key  { color: #666; font-weight: 600; width: 40%; }
.given-val  { color: #2c3e50; font-weight: 700; }

.q-formula {
    background: linear-gradient(135deg, #f0f4ff, #e8f4fd);
    border-left: 4px solid #667eea;
    border-radius: 8px;
    padding: 10px 14px;
    margin: 10px 0;
    font-size: 0.88rem;
    color: #555;
}
.q-formula code {
    font-family: 'Courier New', monospace;
    color: #2c3e50;
    font-weight: 600;
}

/* Container nhiều ô nhập */
.calc-inputs {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 14px 0 8px;
}

/* Mỗi hàng câu hỏi con */
.calc-input-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.calc-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #555;
}

/* Nhãn a) b) c) */
.calc-part-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px; height: 24px;
    background: #667eea;
    color: white;
    border-radius: 50%;
    font-size: 0.78rem;
    font-weight: 700;
    flex-shrink: 0;
}

.calc-input {
    width: 100%;
    padding: 11px 16px;
    border: 2px solid #ddd;
    border-radius: 12px;
    font-size: 1rem;
    color: #2c3e50;
    transition: border-color 0.2s, background 0.2s;
    box-sizing: border-box;
    background: white;
}
.calc-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
}
.calc-input-correct {
    border-color: #27ae60 !important;
    background: #eafaf1 !important;
    color: #1e8449 !important;
}
.calc-input-incorrect {
    border-color: #e74c3c !important;
    background: #fdecea !important;
    color: #c0392b !important;
}

/* Tóm tắt kết quả nhiều phần */
.calc-summary {
    margin: 8px 0 4px;
    text-align: left;
}
.calc-summary-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    font-size: 0.88rem;
}

/* Bước giải trong feedback */
.calc-steps {
    margin: 10px 0;
    background: rgba(255,255,255,0.15);
    border-radius: 10px;
    padding: 10px 14px;
    text-align: left;
}
.calc-step {
    font-size: 0.88rem;
    padding: 3px 0;
    font-family: 'Courier New', monospace;
}

/* ─── DẠNG 3: ĐIỀN TỪ ───────────────────────────────────── */
.q-instruction {
    font-size: 0.92rem;
    color: #555;
    margin: 8px 0 14px;
    font-style: italic;
}

/* Pool từ khóa */
.keyword-pool {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px;
    background: linear-gradient(135deg, #f0f4ff, #e8f0fe);
    border: 2px dashed #b0c0f0;
    border-radius: 14px;
    margin-bottom: 18px;
    min-height: 52px;
    transition: background 0.2s, border-color 0.2s;
}
.keyword-pool.pool-drag-over {
    background: linear-gradient(135deg, #e0e8ff, #d5e4ff);
    border-color: #667eea;
}

/* Keyword chip */
.kw-chip {
    background: white;
    border: 2px solid #667eea;
    color: #667eea;
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 0.83rem;
    font-weight: 700;
    cursor: grab;
    user-select: none;
    transition: all 0.18s;
    box-shadow: 0 2px 6px rgba(102,126,234,0.15);
}
.kw-chip:hover   { background: #667eea; color: white; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(102,126,234,0.35); }
.kw-chip:active  { cursor: grabbing; transform: scale(0.96); }
.kw-chip.dragging { opacity: 0.35; }
.kw-chip.kw-hidden { display: none; }

/* Ghost (touch drag) */
.kw-ghost {
    background: #667eea;
    color: white;
    border: 2px solid #5a6fd6;
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 0.83rem;
    font-weight: 700;
    box-shadow: 0 8px 24px rgba(102,126,234,0.5);
}

/* Blank list */
.blank-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 18px;
}
.blank-item { }
.blank-sentence {
    font-size: 0.94rem;
    line-height: 2.4;
    color: #2c3e50;
}

/* Drop slot – trạng thái trống */
.blank-slot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 150px;
    height: 36px;
    padding: 0 8px;
    border-radius: 10px;
    vertical-align: middle;
    transition: all 0.18s;
    cursor: default;
    position: relative;
}
.blank-slot-empty {
    border: 2px dashed #667eea;
    background: #f5f7ff;
}
.blank-slot-empty:hover {
    border-color: #4a5cd0;
    background: #edf0ff;
}
.blank-slot.drag-over {
    border-color: #27ae60 !important;
    border-style: solid !important;
    background: #eafaf1 !important;
    transform: scale(1.04);
    box-shadow: 0 0 0 3px rgba(39,174,96,0.2);
}
.slot-placeholder {
    font-size: 0.8rem;
    color: #aab;
    font-style: italic;
    pointer-events: none;
}

/* Slot đã được điền */
.blank-slot-filled {
    border: 2px solid #667eea;
    background: #667eea;
    cursor: pointer;
    min-width: 150px;
}
.blank-slot-filled:hover {
    background: #5568d4;
    border-color: #5568d4;
}
.blank-slot-filled.dragging { opacity: 0.35; }

/* Tag bên trong slot */
.slot-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    justify-content: space-between;
    padding: 0 4px;
}
.slot-tag span {
    color: white;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 110px;
}

/* Nút X trong slot */
.slot-clear-btn {
    background: rgba(255,255,255,0.25);
    border: none;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
    padding: 0;
}
.slot-clear-btn:hover { background: rgba(255,255,255,0.45); }

/* Sau khi nộp: đúng / sai */
.blank-slot-correct {
    border: 2px solid #27ae60 !important;
    background: #27ae60 !important;
}
.blank-slot-incorrect {
    border: 2px solid #e74c3c !important;
    background: #e74c3c !important;
}

/* Fill blank feedback */
.fb-answers {
    margin: 8px 0;
    text-align: left;
}
.fb-answer-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 0.88rem;
}
.fb-ok  { color: #2ecc71; font-size: 1rem; }
.fb-bad { color: #e74c3c; font-size: 1rem; }
.fb-answer-text { color: rgba(255,255,255,0.9); }
.fb-score {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 6px;
}

/* Responsive */
@media (max-width: 480px) {
    .blank-slot   { min-width: 110px; height: 32px; }
    .slot-tag span { max-width: 75px; font-size: 0.75rem; }
    .kw-chip      { font-size: 0.75rem; padding: 5px 12px; }
    .calc-input   { font-size: 0.9rem; }
}