/* ============================================================
   VuiHoc — phong cách vui tươi cho học sinh
   Nền pastel, biến màu --brand, card bo góc, nút bấm lớn.
   ============================================================ */

:root {
    --brand: #4f46e5;        /* tím-xanh chủ đạo */
    --brand-2: #22c55e;      /* xanh lá nhấn */
    --accent: #f59e0b;       /* cam nhấn (sao, huy hiệu) */
    --ink: #1e293b;          /* chữ chính */
    --ink-soft: #64748b;     /* chữ phụ */
    --bg: #f0f4ff;           /* nền pastel */
    --card: #ffffff;
    --danger: #ef4444;
    --radius: 16px;
    --shadow: 0 4px 14px rgba(79, 70, 229, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: linear-gradient(180deg, #eef2ff 0%, var(--bg) 40%, #fef9ef 100%);
    color: var(--ink);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.vh-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 24px;
}

/* ---------- Header ---------- */
.vh-header {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #c026d3 100%);
    border-bottom: none;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.35);
    position: sticky;
    top: 0;
    z-index: 50;
}

.vh-header-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 12px 16px;
    flex-wrap: wrap;
}

.vh-logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
    text-decoration: none;
}

.vh-nav {
    display: flex;
    gap: 16px;
    flex: 1;
    flex-wrap: wrap;
}

.vh-nav a {
    text-decoration: none;
    color: rgba(255, 255, 255, 0.92);
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 999px;
}

.vh-nav a:hover {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

.vh-auth {
    display: flex;
    align-items: center;
    gap: 10px;
}

.vh-user {
    font-weight: 600;
    color: #fff;
}

.vh-header .vh-btn-ghost {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.7);
}

.vh-header .vh-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.16);
}

.vh-header .vh-btn-primary {
    background: #fff;
    color: #6d28d9;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}

/* ---------- Nút bấm ---------- */
.vh-btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 999px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: transform 0.08s ease, box-shadow 0.15s ease;
}

.vh-btn:active {
    transform: scale(0.97);
}

.vh-btn-primary {
    background: linear-gradient(135deg, var(--brand), #7c3aed);
    color: #fff;
    box-shadow: var(--shadow);
}

.vh-btn-primary:hover {
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.35);
}

.vh-btn-ghost {
    background: transparent;
    color: var(--brand);
    border: 2px solid var(--brand);
}

.vh-btn-big {
    padding: 16px 36px;
    font-size: 1.15rem;
}

/* ---------- Nội dung ---------- */
.vh-main {
    flex: 1;
    padding: 24px 16px 48px;
    width: 100%;
}

.vh-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
}

.vh-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.vh-title {
    font-size: 1.75rem;
    font-weight: 800;
    margin: 0 0 12px;
}

.vh-subtitle {
    color: var(--ink-soft);
    margin: 0 0 20px;
}

/* ---------- Alert ---------- */
.vh-alert {
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-weight: 600;
}

.vh-alert ul {
    margin: 0;
    padding-left: 20px;
}

.vh-alert-success {
    background: #dcfce7;
    color: #166534;
}

.vh-alert-error {
    background: #fee2e2;
    color: #991b1b;
}

.vh-alert-info {
    background: #dbeafe;
    color: #1e40af;
}

/* ---------- Form ---------- */
.vh-field {
    margin-bottom: 16px;
}

.vh-field label {
    display: block;
    font-weight: 700;
    margin-bottom: 6px;
}

.vh-field input,
.vh-field select,
.vh-field textarea {
    width: 100%;
    padding: 12px 14px;
    font-size: 1rem;
    border: 2px solid #cbd5e1;
    border-radius: 12px;
    background: #fff;
}

.vh-field input:focus,
.vh-field select:focus,
.vh-field textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* ---------- Footer ---------- */
.vh-footer {
    background: var(--card);
    border-top: 3px solid var(--brand);
    padding: 20px 0;
    text-align: center;
    color: var(--ink-soft);
}

.vh-footer p {
    margin: 4px 0;
}

.vh-footer-small {
    font-size: 0.85rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
    .vh-header-inner {
        gap: 12px;
    }

    .vh-nav {
        order: 3;
        width: 100%;
        gap: 8px;
    }
}

/* ============================================================
   Gameplay — màn hình chơi game (agent Gameplay, phase 2)
   ============================================================ */
.vh-play { max-width: 100%; margin: 0 auto; padding-bottom: 32px; }
.vh-play-kicker { color: var(--ink-soft); font-weight: 600; font-size: .9rem; }
.vh-play-title { margin: 4px 0 8px; font-size: 1.6rem; }
.vh-play-sub { color: var(--ink-soft); margin: 0 0 16px; }
.vh-play-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }

.vh-play-timer { display: flex; align-items: center; gap: 8px; background: var(--card);
    border: 2px solid var(--brand); border-radius: 999px; padding: 8px 18px;
    font-size: 1.4rem; font-weight: 800; box-shadow: var(--shadow); white-space: nowrap; }
.vh-timer-danger { color: var(--danger); animation: vh-blink 1s infinite; }
@keyframes vh-blink { 50% { opacity: .4; } }

.vh-question { margin: 16px 0; padding: 20px; }
.vh-question.is-correct { border-left: 5px solid var(--brand-2); }
.vh-question.is-wrong { border-left: 5px solid var(--danger); }
.vh-q-head { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.vh-q-num { background: var(--brand); color: #fff; font-weight: 700; border-radius: 999px; padding: 2px 12px; font-size: .85rem; }
.vh-q-points { color: var(--ink-soft); font-size: .85rem; margin-left: auto; }
.vh-q-result { font-weight: 700; }
.vh-q-prompt { font-size: 1.1rem; font-weight: 600; margin: 8px 0 12px; line-height: 1.7; }

.vh-options { display: grid; gap: 10px; }
.vh-option { display: flex; gap: 10px; align-items: center; background: #f8faff;
    border: 2px solid #e2e8f0; border-radius: 12px; padding: 12px 14px; cursor: pointer; font-size: 1rem; }
.vh-option:hover { border-color: var(--brand); }
.vh-option input { width: 18px; height: 18px; accent-color: var(--brand); }
.vh-option:has(input:checked) { border-color: var(--brand); background: #eef2ff; font-weight: 600; }

.vh-match-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .vh-match-cols { grid-template-columns: 1fr; } }
.vh-match-col-title { font-weight: 700; margin-bottom: 8px; color: var(--ink-soft); }
.vh-match-item { display: block; width: 100%; text-align: left; margin-bottom: 8px;
    background: #f8faff; border: 2px solid #e2e8f0; border-radius: 12px; padding: 12px 14px;
    font-size: 1rem; cursor: pointer; }
.vh-match-item:hover { border-color: var(--brand); }
.vh-match-item.is-selected { border-color: var(--accent); background: #fffbeb; font-weight: 700; }
.vh-match-item.is-paired { border-color: var(--brand-2); background: #f0fdf4; }
.vh-match-item.is-used { opacity: .55; }
.vh-match-hint { color: var(--ink-soft); font-size: .9rem; margin-top: 8px; min-height: 1.4em; }

.vh-sort-items { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.vh-sort-chip { background: #fff; border: 2px dashed var(--brand); border-radius: 999px;
    padding: 8px 16px; font-size: 1rem; cursor: pointer; }
.vh-sort-chip em { font-style: normal; color: var(--brand-2); font-weight: 700; margin-left: 6px; }
.vh-sort-chip.is-selected { background: #eef2ff; border-style: solid; font-weight: 700; }
.vh-sort-chip.is-assigned { border-style: solid; border-color: var(--brand-2); background: #f0fdf4; }
.vh-sort-cats { display: grid; gap: 12px; }
.vh-sort-cat { border: 2px solid #e2e8f0; border-radius: 12px; padding: 12px; background: #fbfdff; }
.vh-sort-cat-btn { background: var(--brand); color: #fff; border: none; border-radius: 999px;
    padding: 8px 18px; font-size: 1rem; font-weight: 700; cursor: pointer; }
.vh-sort-cat-btn:hover { filter: brightness(1.08); }
.vh-sort-cat-items { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; min-height: 28px; }
.vh-sort-tag { background: #eef2ff; border: 1px solid var(--brand); border-radius: 999px;
    padding: 4px 12px; cursor: pointer; font-size: .9rem; }
.vh-sort-empty { color: var(--ink-soft); font-size: .85rem; }

.vh-fill-prompt { font-weight: 500; }
.vh-blank { display: inline-block; min-width: 140px; max-width: 100%; margin: 2px 4px; padding: 6px 10px;
    border: 2px solid var(--brand); border-radius: 8px; font-size: 1rem; }
.vh-blank:focus { outline: none; box-shadow: 0 0 0 3px rgba(79,70,229,.2); }

.vh-play-actions { text-align: center; margin: 24px 0; }

.vh-result-summary { display: flex; gap: 24px; align-items: center; padding: 24px; margin: 16px 0; flex-wrap: wrap; }
.vh-result-big { font-size: 3rem; font-weight: 800; color: var(--brand); }
.vh-result-big span { font-size: 1.4rem; color: var(--ink-soft); }
.vh-result-label { color: var(--ink-soft); font-weight: 600; }
.vh-result-stats { display: flex; gap: 24px; flex-wrap: wrap; }
.vh-stat { display: flex; flex-direction: column; }
.vh-stat-v { font-size: 1.5rem; font-weight: 800; }
.vh-stat-k { color: var(--ink-soft); font-size: .85rem; }

.vh-gami { margin: 16px 0; padding: 20px; }
.vh-section-title { font-size: 1.2rem; margin: 20px 0 12px; }
.vh-gami-row { display: flex; gap: 12px; flex-wrap: wrap; }
.vh-gami-item { background: #fffbeb; border: 2px solid var(--accent); border-radius: 12px;
    padding: 10px 16px; font-weight: 700; }
.vh-gami-levelup { background: #f0fdf4; border-color: var(--brand-2); font-size: 1.1rem; }
.vh-badges { display: grid; gap: 10px; margin-top: 12px; }
.vh-badge { display: flex; gap: 12px; align-items: center; background: #fff;
    border: 2px solid #fde68a; border-radius: 12px; padding: 10px 14px; }
.vh-badge-icon { font-size: 2rem; }
.vh-badge-name { font-weight: 700; }
.vh-badge-desc { color: var(--ink-soft); font-size: .85rem; }
/* Huy hiệu nhỏ "Lớp X" trên thẻ bài học (dùng kèm .lib-badge ở các trang thư viện/trò chơi) */
.vh-badge-grade { background: #ede9fe; color: #5b21b6; }

.vh-review-items { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 8px; }
.vh-review-items li { background: #f8faff; border-radius: 10px; padding: 10px 14px; }
.vh-review-items li.is-correct { background: #f0fdf4; }
.vh-review-items li.is-wrong { background: #fef2f2; }
.vh-review-label { font-weight: 700; margin-bottom: 4px; }
.vh-review-answers { display: flex; flex-direction: column; gap: 4px; }
.vh-correct-text { color: var(--brand-2); }
.vh-explanation { background: #fffbeb; border-left: 4px solid var(--accent);
    border-radius: 0 10px 10px 0; padding: 10px 14px; margin-top: 12px; }

.vh-next { margin: 16px 0; padding: 20px; }
.vh-next-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.vh-next-label { color: var(--ink-soft); font-size: .9rem; }
.vh-next-title { font-weight: 700; font-size: 1.1rem; }
.vh-next-links { margin-top: 16px; display: flex; gap: 16px; }
.vh-next-links a { color: var(--brand); font-weight: 600; text-decoration: none; }

/* ============================================================
   Giao bài (assignments)
   ============================================================ */
.asg-list { display: flex; flex-direction: column; gap: 12px; }
.asg-item { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap;
    background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.asg-item-main { flex: 1; min-width: 220px; }
.asg-item-title { font-weight: 800; font-size: 1.05rem; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.asg-item-meta { color: var(--ink-soft); font-size: 0.9rem; margin-top: 6px; }
.asg-item-note { margin-top: 8px; font-size: 0.92rem; background: #fef9c3; border-radius: 10px; padding: 8px 12px; }
.asg-item-actions { display: flex; gap: 8px; align-items: center; }
.asg-item-actions form { margin: 0; }
.asg-pill { display: inline-block; padding: 4px 14px; border-radius: 999px; font-size: 0.82rem; font-weight: 700; }
.asg-pill-pending { background: #fef3c7; color: #92400e; }
.asg-pill-done { background: #dcfce7; color: #166534; }
.asg-pill-overdue { background: #fee2e2; color: #991b1b; }
.asg-overdue { border: 2px solid var(--danger); }
.pa-weak { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 12px 0; border-bottom: 1px solid #f1f5f9; }
.pa-weak:last-child { border-bottom: none; }
@media (max-width: 640px) {
    .asg-item { padding: 12px 14px; }
    .asg-copy { font-size: 0.85rem; }
}
