/* Base Variables & Modern Design Tokens */
:root {
    --apollo-blue: #0033A0;
    --apollo-orange: #FF671F;
    --apollo-light-blue: #40A8E0;
    --bg-dark: #bcdaf2;
    --text-light: #2576b9;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.9);
    --target-yellow: #ffd95c;
    --target-pink: #e94286;
    /* Chiều cao thật của header, được JS cập nhật lại theo breakpoint */
    --header-h: 82px;

    /* ── Design tokens (đồng bộ với apollo.edu.vn/hieu-biet-ve-apollo) ──
       Mọi màn KHÔNG PHẢI câu hỏi (intro, kết quả, form, CTA) dùng chung
       thang chữ Montserrat và bộ nút / thẻ dưới đây. */
    --font-ui: 'Montserrat', sans-serif;
    --ink: #1a2a4a;        /* chữ chính */
    --ink-soft: #4a5568;   /* chữ phụ */
    --ink-mute: #94a3b8;   /* chữ mờ (mẫu số, chú thích) */
    --line-soft: rgba(0, 51, 160, 0.1);
    --soft-grad: linear-gradient(135deg, #fff5f7 0%, #f0f4ff 100%);
    --card-shadow: 0 8px 32px rgba(0, 0, 0, 0.10);
    --soft-shadow: 0 4px 20px rgba(0, 51, 160, 0.06);
}

/* ══════════════════════════════════════════════════════════════════════
   BỘ ĐỊNH DẠNG DÙNG CHUNG
   Nguồn: apollo.edu.vn/hieu-biet-ve-apollo. Áp cho intro, CTA, kết quả,
   form — KHÔNG áp cho màn hình câu hỏi (giữ nguyên định dạng bài thi).
   ══════════════════════════════════════════════════════════════════════ */

/* Nhãn nhỏ in hoa phía trên tiêu đề */
.u-eyebrow {
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--target-pink);
}

/* Tiêu đề màn hình */
.u-title {
    font-family: var(--font-ui);
    font-size: 26px;
    font-weight: 700;
    color: var(--apollo-blue);
    line-height: 1.3;
    margin: 0;
}

/* Tiêu đề khối / cột */
.u-h3 {
    font-family: var(--font-ui);
    font-size: 20px;
    font-weight: 600;
    color: var(--apollo-blue);
    line-height: 1.3;
    margin: 0;
}

/* Đoạn văn */
.u-text {
    font-family: var(--font-ui);
    font-size: 18px;
    font-weight: 400;
    color: var(--ink);
    line-height: 1.7;
    margin: 0;
}

.u-text-soft {
    font-family: var(--font-ui);
    font-size: 18px;
    font-weight: 400;
    color: var(--ink-soft);
    line-height: 1.65;
    margin: 0;
}

.u-text strong,
.u-text-soft strong {
    font-weight: 700;
    color: var(--apollo-blue);
}

.u-hint {
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 400;
    color: var(--ink-mute);
}

/* Thẻ nội dung nền trắng */
.u-card {
    background: #fff;
    border-radius: 20px;
    box-shadow: var(--card-shadow);
}

/* Khối nền pastel (hero kết quả, hộp thông tin) */
.u-soft-box {
    background: var(--soft-grad);
    border: 1.5px solid var(--line-soft);
    border-radius: 24px;
    box-shadow: var(--soft-shadow);
}

/* Nút — một định dạng duy nhất, chỉ khác màu theo vai trò */
.u-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.95rem 2rem;
    border: none;
    border-radius: 100px;
    font-family: var(--font-ui);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.1s ease;
}

.u-btn:hover:not(:disabled) {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.u-btn:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

.u-btn--primary { background: var(--apollo-blue); color: #fff; }
.u-btn--accent  { background: var(--target-yellow); color: var(--apollo-blue); box-shadow: 0 6px 20px rgba(255, 217, 92, 0.45); }
.u-btn--pink    { background: var(--target-pink); color: #fff; box-shadow: 0 6px 20px rgba(233, 66, 134, 0.4); }

/* Ô nhập & select */
.u-label {
    display: block;
    font-family: var(--font-ui);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-light);
    margin: 0 0 0.45rem;
}

/* Nhân đôi class để thắng rule gạch chân cũ của input[type=...] / select */
.u-input.u-input {
    width: 100%;
    padding: 0.9rem 1.2rem;
    border: 2px solid rgba(0, 51, 160, 0.15);
    border-radius: 100px;
    background: #fff;
    color: var(--apollo-blue);
    font-family: var(--font-ui);
    font-size: 16px;
    font-weight: 400;
    text-align: left;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.u-input.u-input:focus {
    border-color: var(--apollo-blue);
    box-shadow: 0 0 0 3px rgba(0, 51, 160, 0.1);
}

.u-input.u-input:disabled {
    opacity: 0.55;
    background: #f7fafc;
    cursor: not-allowed;
}

/* Chip chọn (ngày, khung giờ, Có/Chưa) */
.u-chip {
    display: inline-flex;
    position: relative;
    margin: 0;
}

.u-chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.u-chip span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 1rem;
    background: #fff;
    border: 2px solid rgba(0, 51, 160, 0.12);
    border-radius: 100px;
    font-family: var(--font-ui);
    font-size: 15px;
    font-weight: 400;
    color: var(--ink-soft);
    text-align: center;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}

.u-chip:hover span { border-color: var(--apollo-blue); }

.u-chip input:checked + span {
    background: rgba(0, 51, 160, 0.07);
    border-color: var(--apollo-blue);
    color: var(--apollo-blue);
    font-weight: 600;
}

@media (max-width: 768px) {
    .u-eyebrow { font-size: 12px; letter-spacing: 1.5px; }
    .u-title   { font-size: 20px; }
    .u-h3      { font-size: 18px; }
    .u-text,
    .u-text-soft { font-size: 16px; line-height: 1.65; }
    .u-btn     { font-size: 15px; padding: 0.85rem 1.5rem; }
    .u-label   { font-size: 14px; }
    .u-input.u-input { font-size: 16px; padding: 0.8rem 1.1rem; }
    .u-chip span { font-size: 14px; padding: 0.6rem 0.85rem; }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Baskerville', serif;
    background-color: var(--bg-dark);
    background-image: url("https://apollo.edu.vn/apollo/images/test-pages/cambridge-2024/bg.webp?v=2");
    background-position: top;
    background-repeat: no-repeat;
    background-size: cover;
    color: var(--text-light);
    min-height: 100vh;
    overflow-x: hidden;
}

/* SPA View Logic */
.view {
    display: none;
    opacity: 0;
    animation: fadeIn 0.4s ease forwards;
    min-height: calc(100vh - var(--header-h));
    min-height: calc(100dvh - var(--header-h)); /* dvh: trừ thanh địa chỉ trình duyệt di động */
    padding: 2rem;
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    box-sizing: border-box;
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

/* Typography */
h1, h2, h3 {
    font-family: 'Brauer NeueVN', sans-serif;
}

/* Global Header */
.global-header {
    background: #fff;
    width: 100%;
    border-bottom: 2px solid rgba(0, 51, 160, 0.1);
    z-index: 100;
    position: sticky;
    top: 0;
}
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
    padding: 1rem 2rem;
    box-sizing: border-box;
}
.header-info {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-grow: 1;
    justify-content: center;
}
.global-logo {
    height: 35px;
    cursor: pointer;
    transition: transform 0.2s;
}
.global-logo:hover {
    transform: scale(1.05);
}
.btn-exit {
    background: #fff;
    color: var(--apollo-blue);
    border: 2px solid var(--apollo-blue);
    padding: 0.5rem 1.5rem;
    border-radius: 100px;
    font-family: 'Brauer NeueVN', sans-serif;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    margin-left: auto;
    transition: 0.2s;
    z-index: 101;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.btn-exit:hover {
    background: var(--apollo-blue);
    color: #fff;
}

.home-title {
    color: #2576b9;
    text-shadow: white 4px 0px 0px, white 3.87565px 0.989616px 0px, white 3.51033px 1.9177px 0px, white 2.92676px 2.72656px 0px, white 2.16121px 3.36588px 0px, white 1.26129px 3.79594px 0px, white 0.282949px 3.98998px 0px, white -0.712984px 3.93594px 0px, white -1.66459px 3.63719px 0px, white -2.51269px 3.11229px 0px, white -3.20457px 2.39389px 0px, white -3.69721px 1.52664px 0px, white -3.95997px 0.56448px 0px, white -3.97652px -0.432781px 0px, white -3.74583px -1.40313px 0px, white -3.28224px -2.28625px 0px, white -2.61457px -3.02721px 0px, white -1.78435px -3.57996px 0px, white -0.843183px -3.91012px 0px, white 0.150409px -3.99717px 0px, white 1.13465px -3.8357px 0px, white 2.04834px -3.43574px 0px, white 2.83468px -2.82216px 0px, white 3.44477px -2.03312px 0px, white 3.84068px -1.11766px 0px, white 3.9978px -0.132717px 0px;
    font-family: 'Brauer NeueVN', sans-serif;
    font-size: 5rem;
    margin-bottom: 0.5rem;
}

.glow-text {
    font-size: 3rem;
    text-align: center;
    color: var(--apollo-blue);
    text-shadow: #fff 4px 0px 0px, #fff -4px 0px 0px, #fff 0px 4px 0px, #fff 0px -4px 0px;
    margin-bottom: 1rem;
}

.subtitle {
    text-align: center;
    color: var(--apollo-blue);
    font-size: 1.2rem;
    margin-bottom: 2rem;
    font-family: 'Baskerville', serif;
    font-style: italic;
    font-weight: 600;
}

/* Rocket Progress Bar */
.progress-container {
    width: 200px;
    height: 12px;
    background-color: rgba(0, 51, 160, 0.1);
    border-radius: 100px;
    position: relative;
    margin: 0 1rem;
}

.rocket-progress {
    height: 100%;
    background-color: var(--target-pink);
    border-radius: 100px;
    width: 0%;
    transition: width 0.5s ease-in-out;
    position: relative;
}

.rocket-icon {
    position: absolute;
    right: -15px;
    top: -12px;
    font-size: 1.5rem;
}

/* Glassmorphism Panels */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.15);
}

/* Forms & Buttons */
.form-group {
    margin-right: -0.5rem;
    margin-bottom: 1.5rem;
}

.form-group-horizontal {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.form-group-horizontal label {
    flex: 0 0 35%;
    margin-bottom: 0;
    text-align: left;
}

.form-group-horizontal input[type="text"],
.form-group-horizontal input[type="email"],
.form-group-horizontal select {
    flex: 1;
    text-align: left; 
    padding: 0.5rem 1rem;
}

/* Header responsive – collapse nav labels to icons only on mobile */
@media (max-width: 768px) {
    .header-content {
        padding: 0.6rem 1rem;
    }
    .btn-nav span, .btn-exit span {
        display: none;
    }
    .btn-nav i, .btn-exit i {
        font-size: 1.1rem;
    }
    #btn-nav-rules::after    { content: ''; }
    #btn-nav-leaderboard::after { content: ''; }
    #btn-nav-login::after    { content: ''; }
}

@media (max-width: 768px) {
    .form-group-horizontal {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .form-group-horizontal label {
        flex: none;
        width: 100%;
        margin-bottom: 0.5rem;
    }
    .form-group-horizontal input[type="text"],
    .form-group-horizontal input[type="email"],
    .form-group-horizontal select {
        text-align: center;
        padding: 1rem;
    }
}

/* Leaderboard */
.btn-nav {
    background: transparent;
    color: var(--apollo-blue);
    border: none;
    font-family: 'Brauer NeueVN', sans-serif;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
}
.btn-nav:hover {
    color: var(--target-pink);
}

.leaderboard-layout {
    display: flex;
    flex-direction: row;
    gap: 3rem;
    max-width: 1440px;
    margin: 0 auto;
}
.leaderboard-panel {
    flex: 2;
    padding: 2rem;
}
.lookup-panel {
    flex: 1;
    padding: 2rem;
    align-self: flex-start;
}

.leaderboard-list-header {
    display: grid;
    grid-template-columns: 0.5fr 2fr 1fr 1fr;
    font-weight: bold;
    color: var(--apollo-blue);
    padding: 1rem;
    border-bottom: 2px solid rgba(0,0,0,0.1);
    margin-bottom: 1rem;
}
.leaderboard-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.rank-item {
    display: grid;
    grid-template-columns: 0.5fr 2fr 1fr 1fr;
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 0.5rem;
    background: #fff;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    font-weight: bold;
}
.rank-item.top-1 { background: linear-gradient(135deg, #FFD700 0%, #FFF8B0 100%); color: #8F7600; border: 2px solid #FFD700; }
.rank-item.top-2 { background: linear-gradient(135deg, #E0E0E0 0%, #F5F5F5 100%); color: #666; border: 2px solid #E0E0E0; }
.rank-item.top-3 { background: linear-gradient(135deg, #CD7F32 0%, #F4D0B4 100%); color: #8E521B; border: 2px solid #CD7F32; }

.lookup-form input {
    width: 100%;
    padding: 1rem;
    border: 2px solid rgba(0, 51, 160, 0.2);
    border-radius: 100px;
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    box-sizing: border-box;
}
.lookup-result {
    margin-top: 2rem;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 20px;
    text-align: center;
    border: 2px dashed rgba(0, 51, 160, 0.2);
}

@media (max-width: 768px) {
    .leaderboard-layout {
        flex-direction: column;
    }
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-light);
    font-family: 'Baskerville', serif;
}

input[type="text"],
input[type="email"],
select {
    width: 100%;
    padding: 1rem;
    background: transparent;
    border: 1px solid transparent;
    border-bottom: 1px solid var(--text-light);
    border-radius: 0;
    color: var(--text-light);
    font-family: 'Brauer NeueVN', sans-serif;
    font-size: 1.5rem;
    text-align: center;
    transition: all 0.3s;
}

select option {
    background-color: var(--apollo-blue, #0033a0);
    color: #ffffff;
}

select:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

input:focus, select:focus {
    outline: none;
    border-bottom-color: var(--apollo-light-blue);
}

/* Age Hint */
.age-hint {
    font-size: 0.95rem;
    font-weight: normal;
    font-family: 'Baskerville', serif;
    opacity: 0.9;
    letter-spacing: 0px;
}

/* Radio Cards (Level Selection) */
.level-selection {
    display: flex;
    gap: 1rem;
}

.level-radio {
    flex: 1;
    cursor: pointer;
}

.level-radio input {
    display: none;
}

/* Landing & Typography */
.landing-split {
    display: flex;
    gap: 2rem;
    align-items: center;
    max-width: 1000px;
    margin: 0 auto;
}

.landing-stacked {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.landing-banner img {
    width: 100%;
    border-radius: 20px;
    max-height: 450px;
    object-fit: cover;
}

.landing-left {
    flex: 1;
}

.landing-right {
    flex: 1;
    display: flex;
    justify-content: center;
}

.landing-right img {
    max-width: 100%;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: 3px solid rgba(255,255,255,0.1);
}

@media (max-width: 768px) {
    .landing-split {
        flex-direction: column-reverse;
        gap: 2rem;
    }
    .landing-left, .landing-right {
        width: 100%;
    }
    .landing-hero, .landing-hero .glow-text, .landing-hero .subtitle {
        text-align: center;
    }
}

.landing-hero {
    text-align: left;
    margin-bottom: 2rem;
}
.landing-hero .glow-text, .landing-hero .subtitle {
    text-align: left;
}

.level-card {
    display: block;
    text-align: center;
    padding: 1rem;
    border-radius: 100px;
    background: transparent;
    border: 2px solid var(--target-yellow);
    color: var(--target-yellow);
    font-family: 'Brauer NeueVN', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    transition: 0.3s;
}

.level-radio input:checked + .level-card {
    background: var(--target-yellow);
    color: var(--text-light);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.level-radio:nth-child(2) .level-card { border-color: var(--target-pink); color: var(--target-pink); }
.level-radio:nth-child(2) input:checked + .level-card { background: var(--target-pink); color: #fff; }

.level-radio:nth-child(3) .level-card { border-color: #25af6a; color: #25af6a; }
.level-radio:nth-child(3) input:checked + .level-card { background: #25af6a; color: #fff; }

/* Buttons */
.btn-primary {
    background: var(--target-yellow);
    color: var(--text-light);
    border: none;
    padding: 16px 24px 10px 24px;
    border-radius: 100px;
    font-family: 'Brauer NeueVN', sans-serif;
    font-size: 30px;
    font-weight: 700;
    cursor: pointer;
    transition: box-shadow 0.2s, background 0.2s;
    width: 100%;
    box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
    background: #fff;
    color: var(--target-pink);
    border: 2px solid transparent;
    padding: 16px 24px 10px 24px;
    border-radius: 100px;
    font-family: 'Brauer NeueVN', sans-serif;
    font-size: 30px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
    width: 100%;
    box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.1);
}

.btn-secondary:hover {
    background: var(--target-pink);
    color: #fff;
}

/* Layout Utilities */
.tournament-layout {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 2rem;
}

.challenge-panel {
    width: 100%;
    height: 80vh;
    margin: 0 auto;
    display: flex;
    flex-direction: row;
    padding: 0;
    overflow: hidden;
}

.question-side {
    flex: 1;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.image-side {
    flex: 1;
    background-color: rgba(255, 255, 255, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    border-left: 2px dashed rgba(0, 51, 160, 0.2);
}

.image-side img {
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
    animation: floating 3s ease-in-out infinite;
}


@keyframes floating {
    0% { transform: translateY(0px) }
    50% { transform: translateY(-10px) }
    100% { transform: translateY(0px) }
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-option {
    background: var(--target-pink);
    color: #fff;
    border: none;
    padding: 1rem 1.5rem;
    border-radius: 100px;
    font-family: 'Brauer NeueVN', sans-serif;
    font-size: 24px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
    box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.1);
}

.btn-option:hover {
    background: var(--apollo-blue);
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .tournament-layout {
        grid-template-columns: 1fr;
    }

    /* Quiz: stack image above question on mobile */
    .challenge-panel {
        flex-direction: column;
        height: auto;
        min-height: 85vh;
    }

    .image-side {
        flex: 0 0 auto;
        /* Co theo chiều cao màn hình để phần câu hỏi luôn còn chỗ */
        height: clamp(120px, 24vh, 220px);
        border-left: none;
        border-bottom: 2px dashed rgba(0,51,160,0.2);
        order: -1; /* image floats to top */
    }

    .image-side img {
        max-width: 90%;
        max-height: 100%;
    }

    .question-side {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 1.25rem 1.1rem 1.6rem;
        justify-content: flex-start;
        order: 1;
    }

    .options-grid {
        margin-top: 1rem;
    }

    .btn-option {
        font-size: 1.1rem;
        padding: 0.9rem 1rem;
    }
}

/* SSO Buttons */
.sso-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    width: 100%;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 100px;
    font-size: 1.2rem;
    font-weight: bold;
    font-family: 'Baskerville', serif;
    cursor: pointer;
    transition: 0.2s;
    border: 2px solid transparent;
}

.sso-google {
    background: #fff;
    color: #333;
    border: 2px solid #ddd;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.sso-google img {
    height: 1.5rem;
}

.sso-google:hover {
    background: #f8f8f8;
}

.sso-apple {
    background: #000;
    color: #fff;
}

.sso-apple:hover {
    background: #333;
}

/* ── Story Question Layout ─────────────────────────────────────────────── */
.story-layout {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.story-passage-col {
    flex: 1.1;
    padding: 2.5rem 2rem 2.5rem 3rem;
    display: flex;
    flex-direction: column;
    border-right: 2px dashed rgba(0, 51, 160, 0.2);
    background: rgba(255, 255, 255, 0.45);
    overflow: hidden;
}

.story-passage-text {
    flex: 1;
    font-size: 1.2rem;
    color: #333;
    line-height: 1.9;
    overflow-y: auto;
    padding-right: 0.5rem;
    /* Bài đọc trong data/set*.json ngắt đoạn bằng \n\n. Không có dòng này thì
       cả bài dồn thành một khối chữ liền — rất khó đọc với bé 8–12 tuổi. */
    white-space: pre-line;
}

.story-question-col {
    flex: 0.9;
    padding: 2.5rem 3rem 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

.story-sub-counter {
    font-family: 'Brauer NeueVN', sans-serif;
    font-size: 1rem;
    font-weight: bold;
    color: var(--target-pink);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.story-question-col .options-grid {
    margin-top: 1.5rem;
}

@media (max-width: 768px) {
    .story-layout {
        flex-direction: column;
        height: 100%;
        min-height: 0;
        overflow: hidden;
    }
    .story-passage-col {
        border-right: none;
        border-bottom: 2px dashed rgba(0, 51, 160, 0.2);
        padding: 1.1rem 1.1rem 1rem;
        flex: 0 1 auto;
        max-height: 45%;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .story-passage-text {
        font-size: 1.05rem;
        line-height: 1.7;
        overflow: visible; /* cột cha đảm nhận việc cuộn */
    }
    .story-question-col {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 1.25rem 1.1rem 1.6rem;
        justify-content: flex-start;
    }
}

/* Modal Utilities */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem 1rem;
    overflow-y: auto;
    z-index: 1000;
    backdrop-filter: blur(5px);
}
.modal-content {
    background: var(--glass-bg);
    width: 100%;
    max-width: 600px;
    padding: 3rem 2rem;
    position: relative;
    border-radius: 24px;
    /* Form dài hơn màn hình (laptop 13") → cuộn bên trong popup */
    max-height: calc(100vh - 4rem);
    max-height: calc(100dvh - 4rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: fadeIn 0.3s ease-out forwards;
}
.modal-close {
    position: absolute;
    top: 14px;
    right: 18px;
    z-index: 2;
    background: none;
    border: none;
    font-size: 2.5rem;
    cursor: pointer;
    color: var(--apollo-blue);
    line-height: 1;
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    position: relative;
    margin: 2rem 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 2px dashed rgba(0, 51, 160, 0.2);
}

.divider span {
    padding: 0 1rem;
    color: var(--apollo-blue);
    font-family: 'Brauer NeueVN', sans-serif;
    font-weight: bold;
}

/* ── Compound Words Challenge ────────────────────────────────────────── */
.compound-challenge-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    width: 100%;
}

.compound-visuals {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    width: 100%;
}

.compound-box {
    width: 250px;
    height: 250px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    border: 2px dashed rgba(0, 51, 160, 0.2);
}

.compound-box img {
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
}

.compound-symbol {
    font-family: 'Brauer NeueVN', sans-serif;
    font-size: 4rem;
    color: var(--apollo-blue);
    font-weight: bold;
}

.compound-inputs {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1rem;
}

.compound-input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.compound-input {
    width: 250px;
    font-size: 2rem !important;
    text-transform: uppercase;
}

.compound-input::placeholder {
    font-size: 1.2rem;
    opacity: 0.5;
}

@media (max-width: 768px) {
    .compound-visuals {
        flex-direction: column;
        gap: 1rem;
    }
    .compound-box {
        width: 180px;
        height: 180px;
    }
    .compound-symbol {
        font-size: 2.5rem;
        margin: -0.5rem 0;
    }
    .compound-inputs {
        flex-direction: column;
        width: 100%;
    }
    .compound-input {
        width: 100%;
        max-width: 300px;
    }
}

/* ── Character-by-Character Input (Refined for Square Boxes) ───────── */
.letter-box-container {
    display: flex !important;
    flex-direction: row !important;
    gap: 0; /* No gap like the image */
    justify-content: center;
    flex-wrap: nowrap;
    margin: 1.5rem auto;
    padding: 1rem;
    max-width: fit-content;
}

.letter-input {
    width: 60px !important;
    height: 60px !important;
    display: inline-block !important;
    font-size: 2.2rem !important;
    text-align: center;
    text-transform: uppercase;
    background: #ffffff;
    border: 1px solid #999999; /* Neutral gray border */
    border-right-width: 0; /* Avoid double borders */
    border-radius: 0;
    color: #333333;
    font-family: inherit;
    font-weight: bold;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

.letter-input:first-child {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

.letter-input:last-child {
    border-right-width: 1px;
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

.letter-input:focus {
    border-color: var(--apollo-blue) !important;
    border-right-width: 1px !important; /* Restore border on focus */
    outline: 2px solid rgba(0, 51, 160, 0.2);
    z-index: 2;
}

.letter-input.correct {
    background: #e8f5e9 !important;
    border-color: #2e7d32 !important;
    border-right-width: 1px !important;
    color: #2e7d32 !important;
}

.letter-input.incorrect {
    background: #ffebee !important;
    border-color: #c62828 !important;
    border-right-width: 1px !important;
    color: #c62828 !important;
}

@media (max-width: 768px) {
    .letter-input {
        width: 35px !important;
        height: 35px !important;
        font-size: 1.4rem !important;
    }
    .letter-box-container {
        gap: 2px;
        flex-wrap: wrap; /* Allow wrap on very small screens */
    }
}

/* ── Quiz: canh chỉnh trên màn hình điện thoại ──────────────────────────
   Các câu hỏi được render bằng inline style (app.js) nên cần !important. */
@media (max-width: 768px) {
    /* Đề bài & nhãn kỹ năng gọn lại */
    .q-skill { font-size: 1.05rem !important; }
    .q-text  { font-size: 1.25rem !important; margin-bottom: 1rem !important; }

    /* Câu kéo thả / nối câu: thu nhỏ ảnh minh hoạ để chừa chỗ tương tác */
    /* (câu kéo thả không còn cột ảnh — chỉ còn câu nối) */
    .challenge-panel:has(.match-select) .image-side {
        height: 150px;
    }
    .challenge-panel:has(.match-select) .image-side img {
        max-height: 125px;
    }

    /* Kéo thả: chip từ và ô thả vừa ngón tay, không tràn ngang */
    .drag-bank { gap: 0.45rem !important; }
    .drag-word {
        font-size: 1rem !important;
        padding: 0.5rem 0.9rem !important;
    }
    .drag-pairs > div {
        gap: 0.5rem !important;
        margin-bottom: 0.6rem !important;
    }
    .drag-pairs span { font-size: 1rem !important; }
    .drop-zone {
        min-width: 96px !important;
        height: 42px !important;
        font-size: 1rem !important;
        flex-shrink: 0;
    }

    /* Nối câu: select không đẩy tràn cột */
    .match-select {
        max-width: 150px !important;
        font-size: 0.9rem !important;
    }

    /* Nút đáp án đủ vùng chạm */
    .btn-option { min-height: 48px; }

    /* Màn hướng dẫn (intro) trước khi làm bài */
    .quiz-intro { padding: 2rem 1.2rem !important; }
    .quiz-intro-title { font-size: 1.7rem !important; margin-bottom: 1.2rem !important; }
    .quiz-intro-text { font-size: 1.1rem !important; margin-bottom: 1.5rem !important; }
    .quiz-intro-score { font-size: 1.9rem !important; margin: 0.6rem 0 !important; }
    .quiz-intro .btn-primary { width: 100%; max-width: 320px; }

    /* Màn chốt chặn hoàn thành Part */
    .part-complete { padding: 2rem 1.2rem; }
    .part-complete-emoji { font-size: 3.8rem; margin-bottom: 0.8rem; }
    .part-complete-cheer { margin-bottom: 1.6rem; }
    .part-complete .u-btn { width: 100%; max-width: 320px; }
}

/* Màn hình rất hẹp (iPhone SE, …) */
@media (max-width: 380px) {
    .drop-zone { min-width: 84px !important; }
    .match-select { max-width: 130px !important; }
    .drag-word { font-size: 0.95rem !important; }
}

/* ── Màn chúc mừng hoàn thành Part ── */
.part-complete {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 2rem;
    min-height: 420px;
}

@keyframes partPop {
    0%   { transform: scale(0.5); opacity: 0; }
    70%  { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes partPulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.12); }
}

.part-complete-emoji {
    font-size: 5.5rem;
    margin-bottom: 1.2rem;
    animation: partPop 0.5s ease forwards, partPulse 1.2s ease 0.5s infinite;
}

.part-complete-exclaim { margin-bottom: 0.3rem; }

.part-complete-title {
    color: var(--target-pink);
    margin-bottom: 0.5rem;
}

.part-complete-cheer {
    max-width: 520px;
    margin-bottom: 2.2rem;
}

/* ── Challenge Instructions Slide (quiz-intro-card) ── */
.challenge-panel:has(.quiz-intro-card),
.challenge-panel:has(.quiz-result-card) {
    background: #ffffff !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: 1px solid rgba(0, 51, 160, 0.12) !important;
    border-radius: 24px !important;
    box-shadow: 0 12px 36px rgba(0, 51, 160, 0.12) !important;
    padding: 0 !important;
}

/* ── Final Result Screen (quiz-result-card) ── */
.quiz-result-card {
    background: #ffffff;
    border-radius: 24px;
    padding: 2.5rem 3rem;
    width: 100%;
    max-width: 100%;
    height: 100%;
    margin: 0;
    box-shadow: none;
    display: flex;
    gap: 2.5rem;
    align-items: stretch;
    box-sizing: border-box;
    overflow-y: auto;
}

.result-col {
    display: flex;
    flex-direction: column;
}

.result-left-col {
    flex: 1;
    background: var(--soft-grad);
    border: 1.5px solid var(--line-soft);
    border-radius: 24px;
    box-shadow: var(--soft-shadow);
    padding: 1.8rem;
}

.result-box-header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1.2rem;
    border-bottom: 1px dashed rgba(0, 51, 160, 0.15);
}

.result-badge-score {
    display: inline-block;
    background: var(--apollo-blue);
    color: #ffffff;
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 0.35rem 1.1rem;
    border-radius: 100px;
    margin-bottom: 0.8rem;
}

.result-score-title {
    font-family: var(--font-ui);
    font-size: 16px;
    font-weight: 400;
    color: var(--ink-soft);
    margin: 0 0 0.5rem 0;
}

.result-score-main {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.3rem;
    margin-bottom: 0.4rem;
}

.score-num {
    font-family: var(--font-ui);
    font-size: 64px;
    font-weight: 700;
    color: var(--apollo-blue);
    line-height: 1;
}

.score-denom {
    font-family: var(--font-ui);
    font-size: 40px;
    font-weight: 400;
    color: var(--ink-mute);
}


.result-part-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: 0.5rem;
}

.breakdown-title {
    font-family: var(--font-ui);
    font-size: 20px;
    font-weight: 600;
    color: var(--apollo-blue);
    margin: 0 0 0.6rem 0;
}

.part-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Movers/Flyers có 6 Part — xếp dọc thì danh sách cao hơn khung kết quả và bị
   cắt mất 2 Part cuối. Trên desktop chia 2 cột để 6 Part gọn trong 3 hàng. */
@media (min-width: 481px) {
    .part-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.6rem 0.7rem;
        align-content: start;
    }
    .part-item { padding: 0.6rem 0.85rem; }
    .part-badge-sm,
    .part-score-text { font-size: 15px; }

    /* Cột trái tự cuộn nếu vẫn còn dài (màn hình rất thấp) thay vì tràn ra ngoài */
    .result-left-col { min-height: 0; }
    .result-part-breakdown { min-height: 0; }
}

.part-item {
    background: #ffffff;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.part-item-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.part-badge-sm {
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 16px;
    color: var(--apollo-blue);
}

.part-score-text {
    font-family: var(--font-ui);
    font-size: 16px;
    font-weight: 600;
    color: var(--ink);
}

.part-progress-bar {
    width: 100%;
    height: 8px;
    background: #edf2f7;
    border-radius: 100px;
    overflow: hidden;
}

.part-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #27ae60, #2ecc71);
    border-radius: 100px;
    transition: width 0.5s ease;
}

.result-col-divider {
    width: 1px;
    background: #e2e8f0;
    align-self: stretch;
}

/* Right Column: Minimum Font Size 18px */
.result-right-col {
    flex: 1.25;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    text-align: left;
}

.result-tier-emoji {
    font-size: 4rem;
    line-height: 1;
    margin-bottom: 0.8rem;
}

.tier-badge-label {
    display: inline-block;
    color: #ffffff;
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 0.4rem 1.2rem;
    border-radius: 100px;
    margin-bottom: 1rem;
}

.tier-main-title {
    font-family: var(--font-ui);
    font-size: 26px;
    font-weight: 700;
    color: var(--apollo-blue);
    line-height: 1.3;
    margin: 0 0 1rem 0;
}

.tier-msg-box {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    margin-bottom: 1.8rem;
}

.tier-msg-text,
.tier-pitch-text {
    font-family: var(--font-ui);
    font-size: 18px;
    font-weight: 400;
    color: var(--ink);
    line-height: 1.7;
    margin: 0;
}

.tier-msg-text strong,
.tier-pitch-text strong {
    color: var(--apollo-blue);
    font-weight: 700;
}

.result-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    width: 100%;
}

/* CTA kết quả = .u-btn--accent */
.btn-primary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.95rem 2rem;
    border: none;
    border-radius: 100px;
    background: var(--target-yellow);
    color: var(--apollo-blue);
    font-family: var(--font-ui);
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(255, 217, 92, 0.45);
    transition: filter 0.15s ease, transform 0.1s ease;
}

.btn-primary-action:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.quiz-intro-card {
    background: #ffffff;
    border-radius: 24px;
    padding: 2.5rem 3rem;
    width: 100%;
    max-width: 100%;
    height: 100%;
    margin: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow-y: auto;
}

.quiz-intro-header {
    text-align: left;
    margin-bottom: 2rem;
}

.quiz-intro-main-title {
    font-family: var(--font-ui);
    font-size: 26px;
    font-weight: 700;
    color: var(--apollo-blue);
    line-height: 1.3;
    margin: 0 0 1rem 0;
}

.quiz-intro-welcome {
    font-family: var(--font-ui);
    font-size: 18px;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.6;
    margin: 0 0 0.8rem 0;
}

.quiz-intro-welcome strong {
    color: var(--apollo-blue);
    font-weight: 700;
}

.quiz-intro-desc {
    font-family: var(--font-ui);
    font-size: 18px;
    font-weight: 400;
    color: var(--ink-soft);
    line-height: 1.65;
    margin: 0;
}

.quiz-intro-grid {
    display: flex;
    align-items: stretch;
    gap: 2rem;
    margin-bottom: 2.5rem;
}

.intro-col {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.intro-rules-col {
    flex: 1;
}

.intro-struct-col {
    flex: 1.25;
}

.col-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.col-icon-badge {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 51, 160, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.col-title {
    font-family: var(--font-ui);
    font-size: 18px;
    font-weight: 700;
    color: var(--apollo-blue);
    letter-spacing: 0.06em;
    margin: 0;
}

.col-divider {
    width: 1px;
    background-color: #e2e8f0;
    align-self: stretch;
}

/* Rules List */
.rules-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.rules-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-family: var(--font-ui);
    font-size: 18px;
    font-weight: 400;
    color: var(--ink);
    line-height: 1.6;
}

.rules-list .check-icon {
    flex-shrink: 0;
    margin-top: 3px;
    display: inline-flex;
}

/* Structure Table */
.table-wrapper {
    width: 100%;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    background: #ffffff;
}

.struct-table {
    width: 100%;
    border-collapse: collapse;
    text-align: center;
    font-family: var(--font-ui);
    font-size: 16px;
}

.struct-table thead tr {
    background-color: var(--apollo-blue, #0033a0);
    color: #ffffff;
}

.struct-table th {
    padding: 0.85rem 0.6rem;
    font-weight: 600;
    font-size: 15px;
    border: none;
}

.struct-table td {
    padding: 0.9rem 0.6rem;
    border-top: 1px solid #edf2f7;
    color: var(--ink);
    font-size: 16px;
}

.struct-table tr.active-row {
    background-color: #fff9e6 !important;
    font-weight: 600;
}

.struct-table .lvl-starters {
    color: #ff9800;
    font-weight: 700;
    text-align: left;
    padding-left: 1rem;
}

.struct-table .lvl-movers {
    color: var(--apollo-blue, #0033a0);
    font-weight: 700;
    text-align: left;
    padding-left: 1rem;
}

.struct-table .lvl-flyers {
    color: #27ae60;
    font-weight: 700;
    text-align: left;
    padding-left: 1rem;
}

.struct-table .clock-icon {
    color: var(--apollo-blue, #0033a0);
    margin-right: 2px;
}

/* Footer & Start Button */
.quiz-intro-footer {
    display: flex;
    justify-content: center;
    margin-top: 0.5rem;
}

/* Nút bắt đầu = .u-btn--accent, chỉ rộng thêm phần đệm ngang */
.btn-start-challenge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.95rem 3rem;
    border: none;
    border-radius: 100px;
    background: var(--target-yellow);
    color: var(--apollo-blue);
    font-family: var(--font-ui);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(255, 217, 92, 0.45);
    transition: filter 0.15s ease, transform 0.1s ease;
}

.btn-start-challenge:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .quiz-intro-card {
        padding: 1.5rem 1.2rem;
        border-radius: 16px;
        max-height: none;
    }
    .quiz-intro-main-title {
        font-size: 20px;
        margin-bottom: 0.8rem;
    }
    .quiz-intro-welcome {
        font-size: 16px;
    }
    .quiz-intro-desc {
        font-size: 16px;
    }
    .quiz-intro-grid {
        flex-direction: column;
        gap: 1.8rem;
        margin-bottom: 1.8rem;
    }
    .col-divider {
        display: none;
    }
    .col-title {
        font-size: 16px;
    }
    .rules-list li {
        font-size: 16px;
    }
    .struct-table th, .struct-table td {
        padding: 0.65rem 0.35rem;
        font-size: 14px;
    }
    .struct-table .lvl-starters,
    .struct-table .lvl-movers,
    .struct-table .lvl-flyers {
        padding-left: 0.4rem;
    }
    .btn-start-challenge {
        width: 100%;
        max-width: 320px;
        font-size: 15px;
        padding: 0.85rem 1.5rem;
    }
}

/* ── Popup form: đăng ký làm bài & đặt lịch thi Speaking/Listening ──────
   Cùng một bộ định dạng .u-* ở đầu file; dưới đây chỉ là phần bố cục. */
.modal-content {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: var(--card-shadow);
    text-align: left;
}

.booking-card { max-width: 560px; padding: 2.5rem 2rem 2rem; }

.booking-title,
.form-modal-title {
    padding: 0 1.8rem; /* chừa chỗ cho nút đóng */
    font-family: var(--font-ui);
    font-size: 26px;
    font-weight: 700;
    color: var(--apollo-blue);
    text-align: center;
    line-height: 1.3;
    margin: 0 0 0.7rem;
}

.booking-sub,
.form-modal-sub {
    font-family: var(--font-ui);
    font-size: 16px;
    font-weight: 400;
    color: var(--ink-soft);
    line-height: 1.65;
    text-align: center;
    margin: 0 0 1.6rem;
}

.booking-sub strong,
.form-modal-sub strong { color: var(--apollo-blue); font-weight: 700; }

.booking-form,
#mocktest-form .form-body {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.booking-group {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    text-align: left;
}

.booking-req { color: #ef4444; }

/* Thông tin đã khai ở form đăng ký — chỉ hiển thị lại để xác nhận */
.booking-confirm {
    background: var(--soft-grad);
    border: 1.5px solid var(--line-soft);
    border-radius: 16px;
    padding: 1rem 1.2rem;
}

.booking-confirm-title {
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--target-pink);
    margin: 0 0 0.7rem;
}

.booking-confirm-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin: 0;
}

.booking-confirm-row {
    display: flex;
    align-items: baseline;
    gap: 1rem;
}

.booking-confirm-row dt {
    flex: 0 0 42%;
    font-family: var(--font-ui);
    font-size: 15px;
    font-weight: 400;
    color: var(--ink-soft);
}

.booking-confirm-row dd {
    flex: 1;
    margin: 0;
    font-family: var(--font-ui);
    font-size: 15px;
    font-weight: 600;
    color: var(--apollo-blue);
    text-align: right;
}

/* Ngày trong tuần: 7 chip viết tắt trên một hàng */
.booking-chips {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.4rem;
}

.booking-chips .u-chip { display: flex; margin: 0; }

.booking-chips .u-chip span {
    width: 100%;
    padding: 0.6rem 0.2rem;
}

/* Khung giờ: mỗi khung một dòng */
.booking-slots {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.booking-slots .u-chip { display: flex; margin: 0; }

.booking-slots .u-chip span {
    width: 100%;
    justify-content: flex-start;
    gap: 0.6rem;
    padding: 0.7rem 1.2rem;
    text-align: left;
}

.booking-slots .u-chip span strong {
    flex: 0 0 62px;
    font-size: 16px;
    font-weight: 600;
    color: var(--apollo-blue);
}

.booking-error {
    margin: 0;
    font-family: var(--font-ui);
    font-size: 15px;
    font-weight: 600;
    color: #dc2626;
    text-align: center;
}

.booking-submit,
#mt-submit {
    width: 100%;
    margin-top: 0.3rem;
}

/* Màn xác nhận đặt lịch thành công */
.booking-success { text-align: center; padding: 1rem 0; }

.booking-success-icon {
    width: 68px;
    height: 68px;
    margin: 0 auto 1.1rem;
    border-radius: 50%;
    background: #10b981;
    color: #ffffff;
    font-size: 34px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3);
}

.booking-success-title {
    font-family: var(--font-ui);
    font-size: 26px;
    font-weight: 700;
    color: var(--apollo-blue);
    margin: 0 0 0.7rem;
}

.booking-success-desc {
    font-family: var(--font-ui);
    font-size: 18px;
    font-weight: 400;
    color: var(--ink);
    line-height: 1.7;
    margin: 0 0 1.6rem;
}

.booking-success-desc strong { color: var(--apollo-blue); font-weight: 700; }


@media (max-width: 768px) {
    .booking-card { padding: 2.2rem 1.1rem 1.6rem; }
    .booking-title,
    .form-modal-title,
    .booking-success-title { font-size: 20px; }
    .booking-sub,
    .form-modal-sub { font-size: 15px; margin-bottom: 1.2rem; }
    .booking-success-desc { font-size: 16px; line-height: 1.65; }
    .booking-chips { gap: 0.3rem; }
    .booking-chips .u-chip span { padding: 0.6rem 0.15rem; font-size: 14px; }
    .booking-slots .u-chip span { padding: 0.65rem 1rem; }
    .booking-slots .u-chip span strong { flex: 0 0 54px; }
    .booking-confirm { padding: 0.9rem 1rem; }
    .booking-confirm-row { gap: 0.6rem; }
    .booking-confirm-row dt,
    .booking-confirm-row dd { font-size: 14px; }
}

/* ── Di động: trang làm bài chiếm trọn màn hình ─────────────────────────
   Panel bám sát mép màn hình, cao đúng bằng phần còn lại dưới header;
   mọi thao tác cuộn diễn ra bên trong panel, trang không cuộn theo. */
@media (max-width: 768px) {
    body:has(#view-round1.active),
    body:has(#view-round2.active) {
        overflow: hidden;
    }

    #view-round1.active,
    #view-round2.active {
        display: flex;
        flex-direction: column;
        padding: 0;
        min-height: 0;
        height: calc(100vh - var(--header-h));
        height: calc(100dvh - var(--header-h));
    }

    /* Vòng 2: bỏ sidebar Live Hub để bài thi dùng trọn màn hình */
    #view-round2 .tournament-layout {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
        gap: 0;
    }
    #view-round2 .main-quiz-area {
        display: flex;
        flex: 1;
        min-height: 0;
    }
    #view-round2 .competitor-sidebar {
        display: none;
    }

    #view-round1 .challenge-panel,
    #view-round2 .challenge-panel {
        flex: 1;
        height: auto;
        min-height: 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
        box-shadow: none;
        overflow: hidden;
    }

    /* Màn hướng dẫn & màn kết quả: lấp đầy panel, tự cuộn khi dài */
    #view-round1 .quiz-intro-card,
    #view-round1 .quiz-result-card {
        flex: 1;
        min-height: 0;
        height: auto;
        border-radius: 0;
    }
    .challenge-panel:has(.quiz-intro-card),
    .challenge-panel:has(.quiz-result-card) {
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
    }

    /* Màn chúc mừng hoàn thành Part: canh giữa trong đúng khung màn hình */
    #view-round1 .part-complete {
        flex: 1;
        min-height: 0 !important;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ── Di động: màn hình kết quả xếp dọc ──────────────────────────────── */
@media (max-width: 768px) {
    .quiz-result-card {
        flex-direction: column;
        gap: 1.2rem;
        padding: 1.3rem 1.1rem 1.8rem;
    }
    .result-col-divider {
        display: none;
    }
    .result-left-col {
        padding: 1.1rem;
    }
    /* Đưa phần đánh giá + nút đặt lịch lên trên bảng điểm chi tiết */
    .result-right-col {
        align-items: stretch;
        order: -1;
    }
    .score-num { font-size: 48px; }
    .score-denom { font-size: 30px; }
    .result-score-title { font-size: 15px; }
    .breakdown-title { font-size: 18px; }
    .result-tier-emoji { font-size: 3rem; margin-bottom: 0.5rem; }
    .tier-badge-label { align-self: flex-start; font-size: 12px; letter-spacing: 1.5px; }
    .tier-main-title { font-size: 20px; }
    .tier-msg-text,
    .tier-pitch-text { font-size: 16px; line-height: 1.65; }
    .btn-primary-action { font-size: 15px; padding: 0.85rem 1.5rem; }
    .tier-msg-box { margin-bottom: 1.2rem; }
    .result-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    .btn-primary-action {
        width: 100%;
        text-align: center;
    }
}

/* ── Di động: popup form vừa màn hình, không tràn ────────────────────── */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 1rem 0.75rem;
        align-items: flex-start;
    }
    .modal-content {
        padding: 2rem 1.1rem 1.6rem;
        max-height: calc(100vh - 2rem);
        max-height: calc(100dvh - 2rem);
    }
    .booking-form,
    #mocktest-form .form-body { gap: 0.9rem; }
}

/* ── Writing (câu type "writing" — chấm tay sau) ───────────────────────── */
.writing-side {
    justify-content: center;
}

.writing-hints {
    margin: 0 0 1rem 1.1rem;
    padding: 0;
    color: #444;
    font-size: 1.05rem;
    line-height: 1.7;
}

.writing-input {
    width: 100%;
    border: 2px solid rgba(0, 51, 160, 0.25);
    border-radius: 14px;
    padding: 1rem 1.1rem;
    font-family: inherit;
    font-size: 1.15rem;
    line-height: 1.7;
    color: #222;
    background: #fff;
    resize: vertical;
    min-height: 150px;
}

.writing-input:focus {
    outline: none;
    border-color: var(--apollo-blue);
    box-shadow: 0 0 0 4px rgba(0, 51, 160, 0.12);
}

.writing-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1rem;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 0.95rem;
    color: #666;
}

.writing-note {
    font-style: italic;
    opacity: 0.85;
}

@media (max-width: 768px) {
    .writing-input {
        font-size: 1.05rem;
        min-height: 130px;
    }
    .writing-meta {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ── Câu kéo thả (Flyers Part 1): chiếm trọn bề ngang, không có cột ảnh ──
   app.js không render `.image-side` cho type "drag", nên `.question-side`
   là con flex duy nhất. Giới hạn bề rộng dòng chữ cho dễ đọc trên màn rộng. */
.question-side--full {
    flex: 1 1 100%;
    max-width: 100%;
    justify-content: flex-start;
    padding: 2.2rem 2.5rem 2.5rem;
}

/* Bọc nội dung để giới hạn bề rộng dòng chữ mà KHÔNG kéo giãn chip
   "Part 1 / 7" (badge là inline-flex, ép width:100% sẽ thành thanh dài). */
.drag-wrap {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}

@media (max-width: 768px) {
    .question-side--full {
        padding: 1.25rem 1.1rem 1.6rem;
    }
}
