/* ============================================================
   VOCAB GAME ENGINE — CSS dùng chung
   Tách từ <style> inline của vocab.html (chỉ phần game).
   Dùng cho: Sổ từ vựng (vocab.html) + Đọc báo (news-article.html).
   ============================================================ */

/* Fallback biến màu cho các trang không có (vd: đọc báo) */
:root {
    --c-moi: #cbd5e1;
    --c-hoc: #f472b6;
    --c-on: #60a5fa;
    --c-thanh: #34d399;
    --border: #e5e7eb;
    --text-sub: #6b7280;
}

/* Nút đánh giá trạng thái từ (flashcard) */
.bg-moi { background-color: var(--c-moi) !important; }
.bg-hoc { background-color: var(--c-hoc) !important; }
.bg-on { background-color: var(--c-on) !important; }
.bg-thanh { background-color: var(--c-thanh) !important; }

/* MODAL CHUNG CỦA GAME */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
    z-index: 99999;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.modal-box {
    background: #fff;
    width: 95%;
    max-width: 620px;
    border-radius: 20px;
    padding: 30px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    transition: max-width 0.3s ease;
}

.modal-box.large-modal {
    width: 80vw;
    max-width: 80vw;
    min-width: min(700px, 95vw);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 80vh;
    max-height: 80vh;
    height: 80vh;
}

#studyModal .modal-box.bansung-modal {
    width: 100%;
    max-width: 100%;
    flex-shrink: 0;
    height: 100vh;
    max-height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    min-width: 0;
    border-radius: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0;
    background: #0a0f24;
}
#studyModal .bansung-modal .modal-header {
    margin-bottom: 0;
    padding: 10px 14px 8px;
    background: rgba(10,15,36,0.65);
    border-bottom: 1px solid rgba(244,185,66,0.15);
}
#studyModal .bansung-modal .modal-title {
    color: #f5f3ea;
    font-size: 1.05em;
}
#studyModal .bansung-modal .close-btn {
    color: #9aa3c9;
}
#studyModal .bansung-modal .close-btn:hover {
    color: #ffffff;
}
#studyModal .bansung-modal .bgb {
    border-radius: 0;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #f3f4f6;
    padding-bottom: 15px;
}

.modal-title {
    font-size: 1.2em;
    font-weight: 800;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.8em;
    cursor: pointer;
    color: #9ca3af;
    line-height: 1;
}

.close-btn:hover {
    color: #1f2937;
}

/* FLASHCARD CHUẨN CŨ */
.fc-container {
    perspective: 1000px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
}

.fc-card {
    width: 100%;
    height: 320px;
    position: relative;
    transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
    cursor: pointer;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    margin: 0 15px;
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
}

.fc-card.flipped {
    transform: rotateY(180deg);
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    color: #1e293b;
    border: 3px solid rgba(37,99,235,0.3);
}

.fc-text {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.8em;
    font-weight: 900;
    backface-visibility: hidden;
}

.fc-card.flipped .fc-text {
    transform: rotateY(180deg);
    font-size: 1.4em;
    color: #3b82f6;
}

.fc-hint {
    position: absolute;
    bottom: 15px;
    width: 100%;
    text-align: center;
    font-size: 0.85em;
    opacity: 0.7;
    backface-visibility: hidden;
    font-weight: 500;
}

.fc-card.flipped .fc-hint {
    display: none;
}

.fc-nav-btn {
    background: none;
    border: none;
    font-size: 2.5em;
    cursor: pointer;
    color: #9ca3af;
    padding: 10px;
    transition: 0.2s;
}

.fc-nav-btn:hover {
    color: #3b82f6;
    transform: scale(1.1);
}

.fc-controls-flat {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 25px;
}

.fc-controls-flat button {
    background: #f8fafc;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    color: #64748b;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fc-controls-flat button:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.assess-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}

.btn-pastel {
    padding: 12px;
    border: none;
    border-radius: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: 0.2s;
}

.btn-pastel:hover {
    transform: translateY(-2px);
    filter: brightness(0.95);
}

@media (max-width: 600px) {
    .modal-box {
        padding: 12px 8px;
        width: 98%;
        max-width: 100%;
        border-radius: 16px;
    }

    #studyModal .modal-box {
        padding: 10px 6px;
        width: 100%;
        max-height: 85vh;
        overflow-y: auto;
    }

    #studyModal .modal-header {
        margin-bottom: 10px;
        padding-bottom: 10px;
    }

    .fc-container {
        margin-bottom: 15px;
    }

    .fc-card {
        height: 280px;
        margin: 0 5px;
        border-radius: 16px;
    }

    .fc-text {
        font-size: 1.8em;
    }

    .fc-card.flipped .fc-text {
        font-size: 1em;
        padding: 10px 8px !important;
    }

    .fc-card.flipped .fc-text > div:first-child {
        font-size: 1.3em !important;
        margin-bottom: 4px !important;
    }

    .fc-nav-btn {
        font-size: 1.8em;
        padding: 5px;
    }

    .assess-grid {
        gap: 6px;
    }

    .btn-pastel {
        padding: 10px 6px;
        font-size: 0.85em;
    }
}
