:root {
    --cream: #fdfcf0;
    --ink: #2B2B2B;
    --orange: #CC6633;
    --green: #75ad41;
    --brown: #6D3C1F;
    --dark: #1A1A1A;
    --mid-gray: #888;
    --font-display: 'Lexend', sans-serif;
    --font-body: 'Lexend', sans-serif;
    --font-calligraphy: 'Pinyon Script', cursive;
    --font-special: 'Playfair Display', serif;
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
    scrollbar-gutter: stable;
}

#ch2 {
    position: relative;
    z-index: 3;
    background: #F9F6EE;
    box-shadow: 0 -20px 40px rgba(0, 0, 0, 0.05);
    margin-top: -1px;
    padding: 80px 0; /* Đã xóa 40vh */
}

#ch3-club {
    position: relative;
    z-index: 4;
    background: #F0EBD8;
    padding: 80px 24px; /* Đã xóa 40vh */
}

#ch3-twist {
    position: relative;
    z-index: 5;
    background: var(--dark);
    box-shadow: 0 -20px 40px rgba(0, 0, 0, 0.1);
    padding: 80px 24px; /* Đã xóa 40vh */
    color: #fff;
}

#ch4-milestones {
    position: relative;
    z-index: 7;
    background: var(--cream);
    box-shadow: 0 -20px 40px rgba(0, 0, 0, 0.05);
    padding: 80px 24px; /* Đã xóa 40vh */
}

body {
    background: var(--cream);
    color: var(--ink);
    font-family: var(--font-body);
    overflow-x: clip !important;
}

/* ── PRELOADER ── */
#preloader {
    position: fixed;
    inset: 0;
    background: var(--cream);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease, visibility 0.8s;
}

#preloader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.preloader-content {
    text-align: center;
    width: 280px;
}

.preloader-logo {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 2rem;
    color: var(--orange);
    margin-bottom: 24px;
}

.preloader-bar-wrap {
    width: 100%;
    height: 4px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

#preloader-bar {
    height: 100%;
    width: 0%;
    background: var(--orange);
    transition: width 0.3s ease;
}

#preloader-percent {
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--ink);
    opacity: 0.6;
}

/* ── PROGRESS BAR ── */
#progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--orange);
    width: 0%;
    z-index: 1000;
    transition: width 0.1s linear;
}

/* ── HERO ── */
#hero {
    position: relative;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
}

#hero-bg {
    position: absolute;
    inset: 0;
    background: url('assets/com5k.jpg') center/cover no-repeat;
    filter: brightness(0.8);
    z-index: 1;
}

#hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 60%, var(--cream) 100%);
    z-index: 2;
}

#hero-content {
    position: relative;
    z-index: 3;
    padding: clamp(60px, 12%, 120px) clamp(40px, 10%, 100px);
    max-width: 850px;
    width: 95%;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: url('assets/brown_note.png') center/contain no-repeat;
    transform: translateY(-50px) scale(2);
    opacity: 0;
}

.hero-text-wrapper {
    transform: translateY(50px);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero-eyebrow {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: none;
    color: var(--orange);
    margin-bottom: 20px;
    opacity: 0;
    transform: translateY(20px) scale(2);
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 8vw, 6rem);
    font-weight: 900;
    line-height: 0.95;
    color: var(--ink);
    opacity: 0;
    transform: translateY(30px) scale(2);
}

.hero-title span {
    color: var(--orange);
}

.hero-sub {
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: var(--ink);
    font-weight: 300;
    margin-top: 20px;
    max-width: 520px;
    opacity: 0;
    transform: translateY(20px) scale(2);
}

.hero-scroll {
    position: absolute;
    bottom: 48px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    animation: bounce 2s infinite;
}

.hero-scroll svg {
    width: 20px;
    opacity: 0.5;
}

@keyframes bounce {
    0%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    50% {
        transform: translateX(-50%) translateY(8px);
    }
}

.chapter-intro-slide {
    height: 100vh;
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: var(--cream);
    position: relative;
    overflow: hidden;
}

.chapter-intro-bg {
    position: absolute;
    inset: -35% 0;
    background-size: cover;
    background-position: center;
    z-index: 0;
}

.chapter-intro-slide::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1;
}

.floating-card {
    position: relative;
    z-index: 2;
    background: rgba(253, 252, 240, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 60px 40px;
    border-radius: 24px;
    max-width: 760px;
    width: 90%;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.25);
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.4);
    opacity: 0;
}

.floating-card .section-title {
    margin-bottom: 20px;
    color: var(--ink);
}

.floating-card p {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #444;
}

.floating-card strong {
    color: var(--ink);
}

.ch-intro-1 {
    background-color: var(--cream);
}

.ch-intro-2 {
    background-color: #F9F6EE;
}

.ch-intro-3 {
    background-color: #e8e0cc;
}

.ch-intro-4 {
    background-color: var(--brown);
    position: relative;
    z-index: 6;
}

/* ── SECTION BASE ── */
.section {
    padding: 60px 24px;
    max-width: 900px;
    margin: 0 auto;
}

.section-wide {
    padding: 60px 24px;
    max-width: 1100px;
    margin: 0 auto;
}

.chapter-label {
    display: inline-block;
    background: var(--orange);
    color: #fff !important;
    padding: 6px 16px;
    border-radius: 30px;
    font-size: 0.8rem;
    margin-bottom: 20px;
}

.section-title {
    font-size: clamp(2.2rem, 6vw, 4rem);
}

.section-body {
    font-size: 1.05rem;
    line-height: 1.8;
    color: #444;
    max-width: 640px;
}

/* ── GAME SECTION ── */
#game-section {
    position: relative;
    padding: 60px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--cream); /* Fallback background */
}

.game-video-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

#game-bg-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.game-video-overlay {
    position: absolute;
    inset: 0;
    background: rgba(253, 252, 240, 0.7); /* Cream overlay to match theme and ensure readability */
    z-index: 1;
}

.game-inner {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
}

.game-question {
    font-family: var(--font-display);
    font-size: clamp(1.4rem, 4vw, 2.2rem);
    font-weight: 800;
    text-align: center;
    margin-bottom: 0;
}

.cards-grid {
    position: relative;
    width: 100%;
    min-height: 850px;
    margin: 0 auto;
}

.game-center-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 600px;
    z-index: 10;
}

.card-3d {
    position: absolute;
    perspective: 1200px;
    height: 240px;
    cursor: pointer;
    width: 240px;
    opacity: 0;
    transform: translateY(50px) scale(0.5);
    transition: transform 0.6s cubic-bezier(.34, 1.56, .64, 1);
}

/* Base rotation will be combined with animation in JS if needed, 
   but for GSAP to handle it smoothly we keep them here */
.card-3d:nth-of-type(8) {
    top: 4%;
    left: 20%;
    --rot: 8deg;
    transform: translateY(50px) scale(0.5) rotate(var(--rot));
}

/* Cơm */
.card-3d:nth-of-type(2) {
    top: 5%;
    right: 20%;
    --rot: -12deg;
    transform: translateY(50px) scale(0.5) rotate(var(--rot));
}

.card-3d:nth-of-type(3) {
    top: 36%;
    left: -10%;
    --rot: -15deg;
    transform: translateY(50px) scale(0.5) rotate(var(--rot));
}

.card-3d:nth-of-type(4) {
    top: 35%;
    right: -10%;
    --rot: 10deg;
    transform: translateY(50px) scale(0.5) rotate(var(--rot));
}

.card-3d:nth-of-type(5) {
    bottom: 2%;
    left: 5%;
    --rot: 5deg;
    transform: translateY(50px) scale(0.5) rotate(var(--rot));
}

.card-3d:nth-of-type(6) {
    bottom: 10%;
    left: 35%;
    --rot: -10deg;
    transform: translateY(50px) scale(0.5) rotate(var(--rot));
}

.card-3d:nth-of-type(7) {
    bottom: 6%;
    right: 5%;
    --rot: 7deg;
    transform: translateY(50px) scale(0.5) rotate(var(--rot));
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(.34, 1.56, .64, 1);
}

.card-3d.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    inset: 0;
    border-radius: 14px;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 16px;
    overflow: hidden;
}

.card-front {
    background: var(--orange);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.card-front .card-emoji {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.card-front .card-emoji .card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.card-3d:hover .card-img {
    transform: scale(1.1);
}

.card-front .card-hint {
    position: relative;
    z-index: 1;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 12px;
    border-radius: 4px;
    margin-bottom: 4px;
}

.card-front .card-tap {
    position: relative;
    z-index: 1;
    font-size: 0.65rem;
    font-weight: 500;
    background: rgba(0, 0, 0, 0.4);
    padding: 2px 8px;
    border-radius: 4px;
}

.card-back {
    transform: rotateY(180deg);
    padding: 12px;
}

.card-back.lose {
    background: #fdfcf0;
    color: #555;
    border: 2px solid #ddd;
}

.card-back.win {
    background: var(--green);
    color: #1a3a0d;
    border: 2px solid #7aab5f;
    box-shadow: 0 8px 32px rgba(117, 173, 65, 0.4);
    animation: pulse-win 2s infinite;
}

@keyframes pulse-win {
    0% {
        box-shadow: 0 8px 32px rgba(117, 173, 65, 0.4);
    }
    50% {
        box-shadow: 0 8px 48px rgba(117, 173, 65, 0.7);
    }
    100% {
        box-shadow: 0 8px 32px rgba(117, 173, 65, 0.4);
    }
}

.card-back .card-price {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 900;
    line-height: 1;
}

.card-back .card-name {
    font-size: 0.8rem;
    margin-top: 6px;
    font-weight: 500;
    opacity: 0.75;
}

.card-back.lose .card-price {
    color: #c0392b;
}

.card-back.win .card-price {
    color: #1a3a0d;
    font-size: 2rem;
}

.card-tap {
    font-size: 0.65rem;
    opacity: 1;
    margin-top: 8px;
}

.game-reset {
    display: block;
    margin: 30px auto 0;
    background: none;
    border: 2px solid var(--orange);
    color: var(--orange);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 10px 28px;
    border-radius: 40px;
    cursor: pointer;
    letter-spacing: 0.08em;
    transition: background 0.2s, color 0.2s;
}

.game-reset:hover {
    background: var(--orange);
    color: #fff;
}

/* ── STATS ROW ── */
.stats-row {
    position: relative;
    z-index: 2;
    background: #F4F1E1;
    max-width: 100%;
    margin-top: -1px;
    margin-bottom: -1px; /* Lấp khe hở 1px */
    padding: 80px 10vw;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 32px;
}

.stat-item {
    text-align: center;
    transition: transform 0.3s ease;
}

.stat-item:hover {
    transform: scale(1.15);
}

.stat-number {
    font-family: var(--font-special);
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 900;
    line-height: 1;

    background: linear-gradient(135deg, #CC6633 0%, #f4d068 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: var(--orange);
}

.stat-label {
    font-size: 0.85rem;
    color: #666;
    margin-top: 8px;
    line-height: 1.5;
    max-width: 200px;
    margin-left: auto;
    margin-right: auto;
}

/* ── CHAPTER 2: TIMELINE ── */
#ch2 {
    padding: 80px 0 40vh;
}

.timeline-wrap {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 24px;
}

.timeline-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(117, 173, 65, 0.25);
    transform: translateX(-50%);
}

.timeline-progress {
    position: absolute;
    left: 50%;
    top: 0;
    width: 2px;
    height: 100%;
    background: var(--green);
    transform: translateX(-50%) scaleY(0);
    transform-origin: top;
    will-change: transform;
}

.timeline-item {
    display: flex;
    width: 100%;
    padding: 40px 0;
    position: relative;
    align-items: center;
    justify-content: space-between;
    will-change: opacity, transform;
}

.tl-text, .tl-img-wrap {
    width: calc(50% - 40px);
}

.tl-text {
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.timeline-item:nth-child(odd) {
    flex-direction: row;
    text-align: right;
}

.timeline-item:nth-child(even) {
    flex-direction: row-reverse;
    text-align: left;
}

.timeline-item:nth-child(odd) .tl-text {
    transform-origin: center right;
}

.timeline-item:nth-child(even) .tl-text {
    transform-origin: center left;
}

.tl-img-wrap {
    border-radius: 16px;
    background: #fff;
    padding: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);

    aspect-ratio: 4 / 3;
    min-height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    will-change: transform;
}

.timeline-dot {
    position: absolute;
    left: 50%;
    top: 46px;
    transform: translateX(-50%);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 4px rgba(117, 173, 65, 0.25);
    z-index: 1;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease, background 0.4s ease;
}

.timeline-item:hover .timeline-dot {
    transform: translateX(-50%) scale(1.6);
    background: var(--orange);
    box-shadow: 0 0 0 6px rgba(204, 102, 51, 0.3);
}

.timeline-item:hover .tl-text {
    transform: scale(1.15);
}

.tl-time {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--green);
    margin-bottom: 4px;
    transition: color 0.4s ease;
}

.timeline-item:hover .tl-time {
    color: var(--orange);
}

.tl-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--ink);
    margin-bottom: 6px;
}

.tl-body {
    font-size: 0.9rem;
    color: rgba(0, 0, 0, 0.7);
    line-height: 1.7;
}

.tl-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
    display: block;
}

.tl-img-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    background: #fff;
    height: 240px;
}

.tl-img-grid img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    transition: transform 0.5s ease, opacity 0.3s ease;
}

.tl-img-grid:hover img {
    opacity: 0.7;
}

.tl-img-grid img:hover {
    transform: scale(1.1);
    opacity: 1;
    z-index: 2;
    position: relative;
}

/* ── CHAPTER 3 ── */
#ch3-bach-mai {
    padding: 40px 24px;
}

.cinematic-hero {
    width: 100vw;
    height: 100vh;
    margin-left: calc(-50vw + 50%);
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: var(--dark);
    position: relative;
    overflow: hidden;
}

.sunrise-glow {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 150vh;

    background: radial-gradient(
            circle 60vw at bottom center,
            rgba(255, 245, 200, 1) 0%,
            rgba(244, 208, 104, 0.8) 20%,
            rgba(204, 102, 51, 0.4) 45%,
            rgba(0, 0, 0, 0) 70%
    );

    mix-blend-mode: screen;
    pointer-events: none;
    z-index: 1;
}

.cinematic-caption {
    font-size: clamp(2rem, 6vw, 4rem);
    max-width: 800px;
    color: #fff;
    padding: 0 24px;
    position: relative;
    z-index: 2;
}

.highlight-som {
    display: inline-block;
    color: #fff;
}

.cinematic-caption {
    font-size: clamp(2rem, 6vw, 4rem);
    max-width: 800px;
    color: #fff;
    padding: 0 24px;
}

.h-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 80px;
    margin-bottom: 56px;
}

.h-gallery-item {
    aspect-ratio: 4/3;
    border-radius: 10px;
    background: #ddd;
    overflow: hidden;
}

.h-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.img-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e8e0cc 0%, #c8bfaa 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: #888;
    letter-spacing: 0.05em;
}

.pull-quote {
    border-left: 3px solid var(--orange);
    padding: 16px 0 16px 28px;
    margin: 32px 0;
}

.pull-quote blockquote {
    font-family: var(--font-display);
    font-size: clamp(1.4rem, 3vw, 1.8rem); /* Thu nhỏ size lại cho đỡ thô */
    font-weight: 700;
    font-style: italic; /* In nghiêng */
    line-height: 1.5;
    color: var(--ink);
}

.pull-quote cite {
    display: block;
    margin-top: 10px;
    font-size: 0.8rem;
    font-style: normal;
    color: var(--mid-gray);
    letter-spacing: 0.05em;
}

/* ── CHARACTER CARDS ── */
#ch3-club {
    position: relative;
    z-index: 4;
    background: #F0EBD8;
    padding: 80px 0 100px;
    overflow: hidden;
}

.carousel-wrapper {
    position: relative;
    max-width: 1000px;
    margin: 48px auto 0;
    height: 520px;
    perspective: 1200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chars-grid {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-style: preserve-3d;
    cursor: grab;
}

.chars-grid:active {
    cursor: grabbing;
}

.char-card {
    position: absolute;
    width: 320px;
    background: var(--cream);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 0.6s ease, filter 0.6s ease, z-index 0.6s;
}

.char-photo img {
    pointer-events: none;
}

.card-center {
    transform: translateX(0) scale(1) translateZ(0);
    z-index: 3;
    opacity: 1;
    filter: brightness(1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
}

.card-left {
    transform: translateX(-65%) scale(0.85) translateZ(-100px) rotateY(12deg);
    z-index: 2;
    opacity: 0.6;
    filter: brightness(0.8);
    cursor: pointer;
}

.card-right {
    transform: translateX(65%) scale(0.85) translateZ(-100px) rotateY(-12deg);
    z-index: 2;
    opacity: 0.6;
    filter: brightness(0.8);
    cursor: pointer;
}

.card-left:hover, .card-right:hover {
    opacity: 0.8;
}

@media (max-width: 768px) {
    .char-card {
        width: 260px;
    }

    .card-left {
        transform: translateX(-50%) scale(0.8) translateZ(-100px);
    }

    .card-right {
        transform: translateX(50%) scale(0.8) translateZ(-100px);
    }
}

.char-photo {
    height: 330px;
    background: #c8bfaa;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.char-photo img {
    width: 100%;
    height: 100%;
    pointer-events: none;
    object-fit: cover;
}

.char-photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: #888;
}

.char-info {
    padding: 20px;
}

.char-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1rem;
}

.char-role {
    font-size: 0.78rem;
    color: var(--orange);
    font-weight: 600;
    margin-top: 2px;
}

.char-excerpt {
    font-size: 0.85rem;
    color: #666;
    margin-top: 10px;
    line-height: 1.6;
}

.char-expand {
    font-size: 0.75rem;
    color: var(--orange);
    font-weight: 600;
    margin-top: 12px;
    cursor: pointer;
}

@media (max-width: 768px) {
    .char-card {
        width: 280px;
    }
}

/* ── MODAL ── */
.modal-backdrop {
    display: flex;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 500;
    align-items: center;
    justify-content: center;
    padding: 24px;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.modal-backdrop.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal-box {
    background: var(--cream);
    border-radius: 20px;
    max-width: 560px;
    width: 100%;
    padding: 40px;
    position: relative;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(40px);
    opacity: 0;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
}

.modal-backdrop.open .modal-box {
    transform: scale(1) translateY(0);
    opacity: 1;
    transition-delay: 0.1s;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #888;
}

.modal-name {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 800;
}

.modal-role {
    color: var(--orange);
    font-weight: 600;
    margin-bottom: 16px;
}

.modal-story {
    line-height: 1.8;
    color: #444;
}

.modal-quote {
    font-size: 1.1rem;
    font-style: italic;
    line-height: 1.6;
    border-left: 3px solid var(--green);
    padding-left: 20px;
    margin-top: 20px;
    color: #333;
}

/* ── PLOT TWIST (dark section) ── */
#ch3-twist {
    padding: 80px 24px 40vh;
    color: #fff;
}

#ch3-twist .chapter-label {
    color: var(--orange);
}

#ch3-twist .section-title {
    color: #fff;
}

.twist-quotes {
    max-width: 720px;
    margin: 56px auto 0;
}

.twist-quote-item {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    margin-bottom: 48px;
    opacity: 0;
    transform: translateY(20px);
}

.twist-quote-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #333;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--orange);
    font-size: 1.2rem;
}

.twist-quote-text {
    font-size: 1.4rem; /* Thu nhỏ size */
    font-weight: 600;
    font-style: italic; /* In nghiêng */
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
}

.twist-quote-name {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 8px;
    font-style: normal;
    font-weight: 400;
}

/* ── NETWORK DIAGRAM ── */
#ch3-network {
    padding: 60px 24px;
}

.highlight-glow {
    font-family: var(--font-calligraphy);
    font-size: 1.2em;
    background: linear-gradient(90deg, #f4d068, #e67e22);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: #f4d068;
    text-shadow: 0 0 20px rgba(244, 208, 104, 0.4), 0 0 40px rgba(230, 126, 34, 0.2);
    display: inline-block;

    padding: 20px 16px;
    margin: -20px -16px;
}

.network-inner {
    max-width: 1000px;
    margin: 0 auto;
    text-align: center;
}

#network-svg {
    width: 100%;
    max-width: 1000px;
    cursor: grab;
    filter: drop-shadow(0 0 40px rgba(244, 208, 104, 0.1));
    overflow: visible;
}

#network-svg:active {
    cursor: grabbing;
}

/* ── CHAPTER 4 ── */
#ch4-counter {
    padding: 120px 24px;
    text-align: center;
    color: #fff;
}

.big-counter-label {
    font-size: clamp(1rem, 3vw, 1.5rem);
    color: rgba(255, 255, 255, 0.7);
    margin-top: 8px;
    letter-spacing: 0.05em;
}

.counter-divider {
    width: 2px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    margin: 40px auto;
}

.big-counter {
    font-family: var(--font-special);
    font-size: clamp(4rem, 16vw, 11rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.02em;

    background: linear-gradient(60deg, #ffffff, #C0EC94);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;

    color: #fff;
}

/* ── CH4 MILESTONE TIMELINE ── */
#ch4-milestones {
    padding: 80px 24px 20vh;
}

.milestones-wrap {
    position: relative;
    max-width: 800px;
    margin: 64px auto 0;
}

.milestones-wrap::before {
    content: '';
    position: absolute;
    top: 8px;
    bottom: 0;
    left: 130px;
    width: 2px;
    background: rgba(204, 102, 51, 0.2);
}

.milestone-item {
    position: relative;
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 60px;
    margin-bottom: 48px;
    opacity: 0;
    transform: translateY(30px);
}

.milestone-item::before {
    content: '';
    position: absolute;
    left: 131px;
    transform: translateX(-50%);
    top: 14px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--orange);
    box-shadow: 0 0 0 4px var(--cream);
    z-index: 2;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.3s, box-shadow 0.3s;
}

.milestone-item:hover::before {
    transform: translateX(-50%) scale(1.5);
    background: var(--green);
    box-shadow: 0 0 0 4px var(--cream), 0 0 0 8px rgba(117, 173, 65, 0.2);
}

.milestone-year {
    font-family: var(--font-special);
    font-weight: 900;
    font-size: 2.5rem;
    color: var(--brown);
    line-height: 1;
    text-align: right;
    margin-top: 2px;

    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), color 0.4s;
    transform-origin: right center;
}

.milestone-item:hover .milestone-year {
    transform: translateX(-12px) scale(1.15);
    color: var(--orange);
}

.milestone-content {
    background: #fff;
    padding: 32px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
    position: relative;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease;
}

.milestone-content::before {
    content: '';
    position: absolute;
    top: 16px;
    left: -6px;
    width: 16px;
    height: 16px;
    background: #fff;
    transform: rotate(45deg);
    border-bottom-left-radius: 4px;
}

.milestone-item:hover .milestone-content {
    transform: translateX(8px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.08);
}

.milestone-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--ink);
}

.milestone-body {
    font-size: 0.95rem;
    color: #666;
    margin-top: 10px;
    line-height: 1.7;
}

@media (max-width: 768px) {
    .milestone-item {
        grid-template-columns: 1fr;
        gap: 16px;
        padding-left: 40px;
    }

    .milestones-wrap::before {
        left: 16px;
    }

    .milestone-item::before {
        left: 16px;
        top: 6px;
    }

    .milestone-content::before {
        display: none;
    }

    .milestone-item:hover .milestone-content {
        transform: translateX(4px);
    }

    .milestone-year {
        text-align: left;
        font-size: 1.8rem;
        transform-origin: left center;
    }

    .milestone-item:hover .milestone-year {
        transform: translateX(8px) scale(1.1);
    }
}

/* ── CTA ── */
.cta-title {
    font-size: clamp(2.5rem, 8vw, 5rem);
    margin-bottom: 24px;

    background: linear-gradient(90deg, #fdfcf0 0%, #ffb38a 50%, #f4d068 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: #fff;
}

.cta-sub {
    color: rgba(255, 255, 255, 0.7);
    max-width: 480px;
    margin: 0 auto 48px;
    line-height: 1.7;
}

.cta-buttons {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(90deg, #e67e22, #CC6633);
    color: #fff;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 1.05rem;
    padding: 16px 36px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: transform 0.3s, box-shadow 0.3s;
    /* Đổ bóng 2 lớp: 1 lớp để tạo khối, 1 lớp tỏa sáng ra xung quanh */
    box-shadow: 0 8px 24px rgba(204, 102, 51, 0.4), 0 0 15px rgba(204, 102, 51, 0.2);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(204, 102, 51, 0.6), 0 0 25px rgba(204, 102, 51, 0.5);
}

.btn-outline {
    background: transparent;
    color: rgba(255, 255, 255, 0.9);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 1.05rem;
    padding: 16px 36px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.btn-outline:hover {
    border-color: #fff;
    color: var(--dark);
    background: #fff;
}

/* ── NAV ── */
#nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 16px 32px;
    display: flex;
    align-items: center;
    transition: background 0.4s, padding 0.3s;
}

#nav.scrolled {
    background: rgba(253, 252, 240, 0.95);
    backdrop-filter: blur(12px);
    padding: 12px 32px;
    box-shadow: 0 1px 16px rgba(0, 0, 0, 0.07);
}

#nav-logo {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 1.1rem;
    color: #fff;
    transition: color 0.4s;
}

#nav.scrolled #nav-logo {
    color: var(--ink);
}

#nav-chapters {
    margin-left: auto;
    display: flex;
    gap: 28px;
    list-style: none;
}

#nav-chapters a {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: color 0.3s;
}

#nav.scrolled #nav-chapters a {
    color: #666;
}

#nav-chapters a:hover {
    color: var(--orange) !important;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* Mobile tweaks */
@media (max-width: 768px) {
    #nav-chapters {
        display: none;
    }

    .h-gallery {
        grid-template-columns: 1fr;
    }

    .chars-grid {
        padding: 40px calc(50vw - 140px);
    }

    .char-card {
        width: 280px;
    }

    #network-svg {
        max-width: 100%;
    }

    .timeline-line, .timeline-progress {
        left: 24px;
        transform: none;
    }

    .timeline-dot {
        left: 24px;
        transform: translateX(-50%);
    }

    .timeline-item {
        flex-direction: column !important;
        text-align: left !important;
        padding-left: 48px;
        align-items: flex-start !important;
    }

    .tl-text, .tl-img-wrap {
        width: 100% !important;
    }

    .tl-img-wrap {
        margin-top: 16px !important;
    }

    .timeline-item .tl-text {
        transform-origin: center left !important;
    }
}

@media (max-width: 480px) {
    .chars-grid {
        grid-template-columns: 1fr;
    }
}

/* ═══════════════════════════════════════════
   ── LOGIC XẾP LỚP (STACKING) & OVERLAP ──
   ═══════════════════════════════════════════ */

#hero {
    position: sticky;
    top: 0;
    z-index: 1;
}

/* Các Slide mở đầu */
.ch-intro-1 {
    position: relative;
    z-index: 2;
}

.ch-intro-2 {
    position: relative;
    z-index: 3;
}

.ch-intro-3 {
    position: relative;
    z-index: 4;
}

#game-section {
    position: relative;
    z-index: 2;
    scroll-snap-align: start;
}

.stats-row {
    position: relative;
    z-index: 2;
}

#ch2 {
    position: relative;
    z-index: 3;
    background: #F9F6EE;
    box-shadow: 0 -20px 40px rgba(0, 0, 0, 0.05);
    margin-top: -1px;
}

#ch3-bach-mai {
    position: relative;
    z-index: 4;
    background: var(--cream);
    box-shadow: 0 -20px 40px rgba(0, 0, 0, 0.05);
}

#ch3-club {
    position: relative;
    z-index: 4;
    background: #F0EBD8;
}

#ch3-twist {
    position: relative;
    z-index: 5;
    background: var(--dark);
    box-shadow: 0 -20px 40px rgba(0, 0, 0, 0.1);
}

#ch3-network {
    position: relative;
    z-index: 5;
    background: var(--dark);
}

#ch4-counter {
    position: relative;
    z-index: 6;
    background: var(--brown);
    box-shadow: 0 -20px 40px rgba(0, 0, 0, 0.1);
}

#ch4-milestones {
    position: relative;
    z-index: 7;
    background: var(--cream);
    box-shadow: 0 -20px 40px rgba(0, 0, 0, 0.05);
}

#cta {
    position: relative;
    z-index: 8;
    background: linear-gradient(135deg, var(--dark) 0%, var(--brown) 50%, var(--orange) 100%);
    box-shadow: 0 -20px 40px rgba(0, 0, 0, 0.15);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}

#ch3-bach-mai {
    padding-top: 0 !important;
}

#ch2,
#ch3-club,
#ch3-twist,
#ch4-milestones {
    padding-bottom: 80px !important;
}

.galaxy-star {
    fill: #ffffff;
    opacity: 0.1;
    transform-box: fill-box;
    transform-origin: center;
    animation: twinkle linear infinite alternate;
}

@keyframes twinkle {
    0% {
        opacity: 0.1;
        transform: scale(0.8);
    }
    100% {
        opacity: 0.8;
        transform: scale(1.5);
        filter: drop-shadow(0 0 4px #fff);
    }
}