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

html {
    font-size: 64.25%;
}

body {
    font-size: 1.6rem;
    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Oxygen,
        Ubuntu,
        Cantarell,
        "Open Sans",
        "Helvetica Neue",
        sans-serif;
    padding: 20px 0;
    background: #020409;
    color: #f1f6fb;
}
/* .story-title, .chapter-title, .chapter-item, .chap-item, .text{
    color: #f1f6fb;
} */
li {
    list-style-type: none;
}

main {
    max-width: 650px;
    margin: 0 auto;
    border-radius: 10px;
    padding: 20px 40px;
    background: #0e1116;
}
.story-title,
.chap-title {
    position: relative;
    padding-bottom: 20px;
    font-size: 3rem;
    text-transform: uppercase;
}
.story-title::after,
.chap-title::after {
    position: absolute;
    display: inline-block;
    content: "";
    bottom: 0;
    left: 0;
    height: 1px;
    width: 100%;
    background: #3e444c;
}
.chap-title{
    padding-top: 30px;
}
.chapter-group,
.chap-list {
    padding-left: 20px;
}
.chapter-group {
    padding-top: 20px;
}
.chap-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.opa{
    opacity: 0.1;
}
.operation{
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}
.button{
    display: inline-block;
    padding: 10px 20px;
    border: 1px solid #3e444c;
    border-radius: 999px;
    text-decoration: none;
    color: #f1f6fb;
    transition: all 0.3s ease-in-out;
}
.button:hover{
    background:#f1f6fb;
    color: #3e444c;
}
.lantern-btn{
    color: #3e444c;
    transition: all 0.4s ease-in-out;
}
.lantern-btn:hover{
    color: #f1f6fb;
    background: transparent;
}
.home{
    padding-top: 20px;
    padding-bottom: 20px;
    text-align: center;
}
/* chuong 1: chap 1 */
.opening-quote {
    margin-top: 20px;
    font-style: italic;
    font-size: 1.6rem;
    margin-bottom: 20px;
    padding-left: 20px;
    border-left: 4px solid #3e444c;
}
p {
    padding: 20px 0;
    text-align: justify;
    text-indent: 30px;
}
.dialogue {
    padding: 10px 0;
}
.section-break {
    text-align: center;
    margin: 40px 0;
    color: #3e444c;
    font-size: 1.5em;
    letter-spacing: 5px;
}
.dialogue {
    color: #e4e5e6;
}

.footnotes {
    margin-top: 60px;
    padding-top: 30px;
    border-top: 2px solid #3e444c;
    font-size: 0.9em;
}

.footnote-title {
    font-weight: bold;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.footnote-item {
    margin-bottom: 20px;
    padding-left: 30px;
    text-indent: -30px;
}

.footnote-number {
    font-weight: bold;
}

.flower-list {
    margin-left: 50px;
    margin-top: 10px;
}
.opera{
    opacity: 0.2;
}
/* chuong 1: chap 2 */
.letter {
    background: #1a1b1e;
    padding: 30px;
    margin: 30px 0;
    border-left: 4px solid #3e444c;
    border-radius: 0 10px 10px 0;
    font-style: italic;
}

.letter-greeting {
    /* text-align: right; */
    margin-bottom: 20px;
    font-weight: bold;
    color: #7a828a;
}

.letter-closing {
    text-align: right;
    margin-top: 30px;
    font-weight: bold;
    color: #7a828a;
    /* color: #d4803f; */
}

.letter p {
    text-indent: 30px;
    font-style: normal;
}

.letter-decoration {
    text-align: center;
    font-size: 1.2em;
    margin: 10px 0;
}
.thumb {
    display: flex;
    align-items: center;
    justify-content: center;
}
.thumb img{
    width: 80%;
    object-fit: cover;
}
.final-quote {
    text-align: center;
    font-style: italic;
    font-size: 1.1em;
    margin: 40px 0;
    padding: 20px;
    border-top: 2px solid #3e444c;
    border-bottom: 2px solid #3e444c;
}
.thumb{
    height: 50vh;
}
.space{
    height: 50vh;
}
.thumb-dog{
    width: 100%;
}
.thumb-dog--img{
    width: 100%;
    object-fit: cover;
}
/* =============== */

/* --- HIỆU ỨNG ĐÈN LỒNG --- */
#messageText{
    text-align: center;
    text-indent: 0;
}
.sky-container {
    position: fixed;
    top: 0; left: 0px; width: 100%; height: 100%;
    pointer-events: none; /* Không cản trở cuộn trang */
    z-index: 5;
    overflow: hidden;
}
.lantern {
    position: absolute;
    bottom: -100px;
    width: 60px; /* Chỉnh theo kích thước ảnh của bạn */
    height: 90px;
    background-image: url('../img/den.png'); /* <--- THAY ĐƯỜNG DẪN ẢNH TẠI ĐÂY */
    background-size: contain;
    background-repeat: no-repeat;
    cursor: pointer;
    pointer-events: auto; /* Cho phép click vào ảnh */
    filter: drop-shadow(0 0 15px rgba(255, 165, 0, 0.7)); /* Tạo hiệu ứng phát sáng cho ảnh */
    
    animation: riseUp 20s linear infinite;
    animation-delay: var(--d);
    scale: var(--s);
}
.lantern:hover{
    width: 70px;
    height: 110px;
    transition: all 0.2s ease-in-out;
    filter: drop-shadow(0 0 15px rgba(255, 165, 0, 1));
}

.lantern.left { left: var(--p); }
.lantern.right { right: var(--p); }

@keyframes riseUp {
    0% { transform: translateY(0) rotate(0deg); opacity: 0.3; }
    10% { opacity: 1; }
    50% { transform: translateY(-50vh) rotate(10deg) translateX(20px); }
    90% { opacity: 0.3; }
    100% { transform: translateY(-110vh) rotate(-10deg) translateX(-10px); opacity: 0; }
    
}

/* --- BẢNG THÔNG ĐIỆP (MODAL) --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0; top: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    align-items: center; justify-content: center;
}

.modal-content {
    background: #0e1116;
    padding: 30px;
    border: 1px solid #3e444c;
    border-radius: 15px;
    text-align: center;
    max-width: 300px;
    color: #f1f6fb;
    position: relative;
    box-shadow: 0 0 30px rgba(255, 157, 0, 0.3);
    font-style: italic;
    line-height: 1.6;
}

.close-btn {
    position: absolute; top: 5px; right: 15px;
    font-size: 28px; cursor: pointer; color: #7a828a;
}
@media (max-width: 1120px) {
    .lantern{
        width: 40px;
        height: 50px;
    }
    .sky-container.left {
        left: 0;
        width: calc((100% - 700px) / 2);
    }

    .sky-container.right {
        right: 0;
        width: calc((100% - 700px) / 2);
    }

    /* Giảm nhẹ kích thước đèn để không tạo cảm giác chật chội */
    .lantern {
        transform: scale(calc(var(--s) * 0.8));
    }
}

/* --- TỐI ƯU CHO ĐIỆN THOẠI --- */
@media (max-width: 920px) {

    .lantern {
        width: 40px; /* Thu nhỏ kích thước đèn */
        height: 55px;
        /* filter: blur(1px) opacity(1); Làm mờ hẳn đi để không gây xao nhãng */
        /* animation-duration: 20s; Đã chậm rồi, trên điện thoại cho chậm hơn nữa */
    }

    /* .sky-container.left { left: 0; }
    .sky-container.right { right: 0; } */
    
    /* Thu nhỏ bảng thông báo tin nhắn trên điện thoại */
    .modal-content {
        width: 80%;
        padding: 20px;
        font-size: 14px;
    }
    /* Đẩy đèn ra sát mép biên hơn nữa */
    .lantern.left { left: 0% !important; }
    .lantern.right { right: 2% !important; }
}
@media (max-width: 685px){
    .lantern {
        width: 40px; /* Thu nhỏ kích thước đèn */
        height: 55px;
        /* filter: blur(1px) opacity(1); Làm mờ hẳn đi để không gây xao nhãng */
        animation-duration: 20s; /* Đã chậm rồi, trên điện thoại cho chậm hơn nữa */
    }
    .lantern.left { left: -1% !important; }
    .lantern.right { right: 2% !important; }
}
@media (max-width: 500px){
    .operation{
        gap: 5px;
    }
    .button{
        font-size: 1.1rem;
    }
}