@font-face {
    font-family: 'AR PL UKai CN';
    src: url('fonts/ukai.ttc') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

body {
    font-family: 'AR PL UKai CN', "华文楷体", KaiTi, sans-serif;
    font-size: 1.3rem;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background: #f4f4f4;
    color: #333;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 统一为日记页图片添加放大镜覆盖层与悬停效果 */
.image-wrap {
  position: relative;
  display: inline-block;
  /* Ensure wrapper doesn't interfere with image dimensions */
  line-height: 0;
}
.post-image {
  cursor: pointer !important;
  transition: transform 0.2s ease-in-out !important;
  position: relative; /* Ensure image creates positioning context */
}
.image-wrap > img.post-image {
  max-width: 100% !important;
  height: auto !important;
}
.post-image:hover {
  transform: scale(1.05) !important;
}
.image-wrap::after {
  content: "";
  position: absolute;
  /* Position relative to the actual image dimensions */
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  background-color: rgba(0,0,0,0.6);
  border-radius: 50%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='6'/%3E%3Cline x1='11' y1='8' x2='11' y2='14'/%3E%3Cline x1='8' y1='11' x2='14' y2='11'/%3E%3Cline x1='16.5' y1='16.5' x2='21' y2='21'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 70%;
  z-index: 11;
  pointer-events: none;
}

/* Desktop: float image left with smaller width to allow text wrapping */
@media screen and (min-width: 641px) {
  .diary-entry .image-wrap {
    max-width: 30% !important; /* enlarge to 1.5x of previous 20% */
    float: left;
    margin: 6px 12px 10px 0;
    shape-outside: inset(0 round 12px);
    shape-margin: 6px;
    position: relative !important;
  }
  .diary-entry p::after {
    content: "";
    display: table;
    /* clear: both; */ /* Removed to allow text to wrap around floated images */
  }
}

@media screen and (max-width: 640px) {
  .diary-entry .image-wrap {
    max-width: 44% !important;
    float: left;
    margin: 6px 10px 10px 0px !important;
    shape-outside: inset(0 round 12px);
    shape-margin: 6px;
    position: relative !important;
  }
  /* Ensure mobile overlay icon shows on all pages, not just .diary-entry */
  .image-wrap::after {
    top: 4px !important;
    right: 4px !important;
    width: 24px !important;
    height: 24px !important;
  }
  .diary-entry .image-wrap::after {
    top: 4px !important;
    right: 4px !important;
    width: 24px !important;
    height: 24px !important;
    background-color: rgba(0,0,0,0.6) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='6'/%3E%3Cline x1='11' y1='8' x2='11' y2='14'/%3E%3Cline x1='8' y1='11' x2='14' y2='11'/%3E%3Cline x1='16.5' y1='16.5' x2='21' y2='21'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 70% !important;
    z-index: 11 !important;
  }
  .diary-entry p::after {
    content: "";
    display: table;
    clear: both;
  }
}

body.fade-in {
    opacity: 1;
}

header {
    background: #fafafa;
    color: #333;
    padding: 1.5rem 0;
    text-align: center; /* Center content within header */
    width: 100%;
    max-width: 900px; /* Align with main content */
    margin: 0 auto; /* Center the header */
    border-bottom: 1px solid #eee;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    position: relative; /* Added for absolute positioning of children */
}

/* Language switch button */
.lang-switch {
    position: absolute;
    top: calc(10px + env(safe-area-inset-top, 0px));
    left: calc(10px + env(safe-area-inset-left, 0px));
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    background: rgba(51, 51, 51, 0.85);
    color: #fff;
    border-radius: 12px;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,0.15);
    border-bottom: none;
    font-size: 0.9rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    letter-spacing: 0.2px;
    transition: background-color 0.25s, transform 0.15s ease-out;
    z-index: 1100;
}
.lang-switch.lang-zh::before {
    content: "🇨🇳";
    font-size: 0.95rem;
    line-height: 1;
}
.lang-switch.lang-en::before {
    content: "🇬🇧";
    font-size: 0.95rem;
    line-height: 1;
}
.lang-switch:hover {
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    transform: translateY(-1px);
}
html.night-mode .lang-switch {
    background: rgba(85, 85, 85, 0.85);
    color: #f0f0f0;
}
html.night-mode .lang-switch:hover {
    background: #777;
}
@media screen and (max-width: 640px) {
    .lang-switch {
        top: calc(8px + env(safe-area-inset-top, 0px));
        left: calc(8px + env(safe-area-inset-left, 0px));
        padding: 4px 10px;
        font-size: 0.86rem;
        border-radius: 11px;
        box-shadow: 0 1px 4px rgba(0,0,0,0.18);
        gap: 5px;
    }
    .lang-switch.lang-zh::before,
    .lang-switch.lang-en::before {
        font-size: 1.05rem;
    }
}

main {
    padding: 1rem;
    max-width: 900px;
    width: 100%;
    box-sizing: border-box;
}

section {
    background: #fff;
    margin: 1rem 0;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border: 1px solid #ddd; /* Added explicit border */
}

h1, h2, h3 {
    margin-top: 0;
}

h1 {
    font-weight: normal;
    font-size: 2.5rem;
    padding-left: 20px; /* Add left padding */
}

h2 {
    font-weight: 400;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

header p {
    padding-left: 20px; /* Add left padding to header paragraphs */
}

a {
    color: #333;
    text-decoration: none;
    border-bottom: 1px dotted #333;
}

a:hover {
    color: #000;
    border-bottom-style: solid;
}

.category-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.category-item {
    background-color: #f0f0f0;
    padding: 10px 15px;
    border-radius: 20px;
    text-decoration: none;
    color: #333;
    border-bottom: none;
    transition: background-color 0.3s, color 0.3s;
    font-size: 0.9rem;
}

.category-item:hover {
    background-color: #333;
    color: #fff;
    border-bottom: none;
}

footer {
    text-align: center;
    padding: 1rem 0;
    color: #777;
    width: 100%;
}

/* Post List Styles */
.post-list {
    max-width: 100%;
    box-sizing: border-box; /* Ensure padding and border are included in the element's total width */
}

.post-list-item {
    background: #fff;
    margin: 1rem 0;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    position: relative;
}

.post-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.post-list-item:hover {
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    transform: translateY(-10px);
}

.post-list-item a {
    text-decoration: none;
    color: #333;
    border-bottom: none;
}

.post-list-item h3 {
    margin-top: 0;
    margin-bottom: 0;
}

.post-list-item .post-date {
    font-size: 1.1rem;
    color: #555;
    margin-bottom: 0;
    margin-left: 1rem;
    white-space: nowrap;
}

.post-list-item .snippet {
    font-size: 1rem;
    color: #555;
    line-height: 1.7;
}

.post-list-item .read-more-cue {
    display: inline-block;
    margin-top: 1rem;
    color: #007bff;
    font-weight: bold;
}



.post-summary {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.back-link {
    display: inline-block;
    margin-top: 2rem;
    text-decoration: none;
    color: #007bff;
    border-bottom: 1px dotted #007bff;
}

.back-link:hover {
    color: #0056b3;
    border-bottom-style: solid;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem 0;
    gap: 15px;
    flex-wrap: wrap;
}

.page-link {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #555;
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 20px;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.95rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    white-space: nowrap;
}

.page-link:not(:first-child):not(:last-child) {
    width: 60px;
    padding: 0;
    border-radius: 50%;
}

.page-link:hover {
    color: #333;
    background-color: #e8e8e8;
    border-color: #ccc;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.page-link.current {
    color: #fff;
    background-color: #555;
    border-color: #555;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.page-link.current:hover {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(0,0,0,0.25);
}

/* 响应式设计 - 手机端适配 */
@media (max-width: 768px) {
    .pagination {
        gap: 8px;
        padding: 1.5rem 0;
    }
    
    .page-link {
        min-width: 35px;
        height: 35px;
        padding: 0 10px;
        font-size: 0.85rem;
    }
    
    .page-link:not(:first-child):not(:last-child) {
        width: 35px;
        padding: 0;
    }
    
    main {
        padding: 0.5rem;
    }
    
    .post-list-item {
        padding: 1rem;
        margin: 0.5rem 0;
    }
    
    .post-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .post-list-item .post-date {
        margin-left: 0;
        font-size: 1rem;
    }

    .sub-categories {
        margin-bottom: 1.5rem;
        gap: 0.625rem; /* 10px */
    }

    .sub-categories a {
        padding: 0.625rem 0.9375rem; /* 10px 15px */
        font-size: 0.9rem;
    }

    .card-layout .post-list-item {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

.author-separator {
    border: none;
    border-top: 1px solid #eee;
    margin: 2rem 0;
}

/* Sub-category navigation */
.sub-categories {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
    padding: 0 1rem;
}

.sub-categories a {
    display: inline-block;
    padding: 0.5rem 1rem;
    margin: 0 0.5rem;
    border-radius: 20px;
    color: #333;
    background-color: #f0f0f0;
    text-decoration: none;
    border-bottom: none;
    transition: background-color 0.3s, color 0.3s;
}

.sub-categories a:hover {
    background-color: #333;
    color: #fff;
}

.sub-categories a.active {
    background-color: #333;
    color: #fff;
    font-weight: bold;
}

.download-button {
    background-color: #333;
    color: #fff;
    border: 1px solid #333;
    padding: 3px 8px;
    border-radius: 20px;
    text-decoration: none;
    transition: all 0.2s ease; /* Changed to all for smooth transition */
    cursor: pointer;
}

.download-button:hover {
    background-color: #333; /* Keep same background color */
    color: #fff; /* Keep same text color */
    border-color: #333; /* Keep same border color */
    transform: translateY(-1px); /* Subtle lift effect */
    box-shadow: 0 2px 5px rgba(0,0,0,0.2); /* Subtle shadow */
}

.post-image-wide {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 1rem;
    filter: sepia(0.3) brightness(1.1) contrast(0.9) saturate(1.2);
}

.post-image-slideshow {
    display: flex;
    overflow-x: auto; /* Enable horizontal scrolling */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    scroll-snap-type: x mandatory; /* Snap to items */
    gap: 0; /* No gap between images in slideshow */
    /* Removed margin-bottom: 1rem; */
    /* Removed border-radius: 8px; */
    overflow: hidden; /* Hide parts of images that are outside */
    width: 100%; /* Explicitly set width to 100% */
}

/* Hover lift effect for images */
.card-layout .post-image-slideshow .post-image {
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    will-change: transform;
}

.card-layout .post-image-slideshow:hover .post-image {
    transform: translateY(-6px);
}



/* Card Layout for Photo Essay Page */
.card-layout .post-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between; /* Distribute cards evenly */
    gap: 1rem;
}

.card-layout .post-list-item {
    flex: 0 0 calc((100% - 2rem) / 3); /* Adjusted flex to explicitly account for gap */
    max-width: calc((100% - 2rem) / 3); /* Adjusted max-width to explicitly account for gap */
    height: auto;
    margin: 0; /* Removed individual item margins */
    padding: 0 0 1.5rem 0; /* Remove top, left, right padding, keep bottom */
    display: flex;
    flex-direction: column;
}

.card-layout .post-list-item .post-image-slideshow {
    height: 200px; /* Reverted image height for cards */
}

.card-layout .post-list-item .post-item-header {
    flex-direction: column; /* Stack title and date */
    align-items: flex-start;
    padding: 1rem; /* Added padding */
}

.card-layout .post-list-item .post-date {
    margin-left: 0;
    margin-top: 0.5rem;
}

.card-layout .post-list-item .post-summary {
    padding: 0 1rem; /* Added padding */
}

.card-layout .post-list-item .read-more {
    padding: 0 1rem 1rem 1rem; /* Added padding */
}

/* New styles for vertical image cards */
.card-layout .post-list-item-vertical .post-image-slideshow {
    position: relative; /* To position the overlay text */
    height: 300px; /* Fix height to prevent portrait images from appearing oversized */
}

/* Ensure portrait card images fill the container consistently */
.card-layout .post-list-item-vertical .post-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: sepia(0.3) brightness(1.1) contrast(0.9) saturate(1.2);
    border-radius: 0;
    display: block;
    border: none;
    padding: 0;
}

.card-layout .post-list-item-vertical {
    padding: 0; /* Remove all padding for vertical cards */
}

.card-layout .post-list-item-vertical .post-item-header,
.card-layout .post-list-item-vertical .post-summary {
    position: absolute;
    width: 100%;
    box-sizing: border-box;
    color: #fff; /* White text for readability on image */
    text-shadow: 1px 1px 3px rgba(0,0,0,0.8); /* Text shadow for readability */
    padding: 1rem; /* Add some padding for text */
}

.card-layout .post-list-item-vertical .post-item-header {
    top: 0;
    left: 0;
}

.card-layout .post-list-item-vertical .post-summary {
    bottom: 3rem; /* Position above read-more-overlay */
    left: 0;
}

.card-layout .post-list-item-vertical .post-item-header h3 a,
.card-layout .post-list-item-vertical .post-item-header .post-date,
.card-layout .post-list-item-vertical .post-summary {
    color: #fff;
    border-bottom: none;
}

.card-layout .post-list-item-vertical .read-more-overlay {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    background-color: rgba(0, 0, 0, 0.6);
    padding: 0.5rem 1rem;
    border-radius: 5px;
}

.card-layout .post-list-item-vertical .read-more-overlay a {
    color: #fff;
    text-decoration: none;
    border-bottom: none;
}

.card-layout .post-list-item-vertical .read-more-overlay a:hover {
    color: #eee;
}

/* Hide the original read-more for vertical cards */
.card-layout .post-list-item-vertical .read-more {
    display: none;
}

.card-layout .post-list-item .post-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: sepia(0.3) brightness(1.1) contrast(0.9) saturate(1.2);
    border-radius: 0; /* Removed border-radius */
    display: block; /* Added display block */
    border: none;
    padding: 0;
}

.quote-separator {
    border: none;
    border-top: 1px solid #ccc;
    margin: 2rem auto; /* Center it and give some vertical space */
    width: 100%;
    opacity: 0.7; /* Make it slightly transparent */
}

/* Night Mode Styles */
html.night-mode body {
    background-color: #1a1a1a; /* Dark background for the page */
    color: #e0e0e0; /* Light text color */
}

html.night-mode header,
html.night-mode footer {
    background-color: #2a2a2a; /* Slightly lighter dark for header/footer */
    color: #f0f0f0;
}

html.night-mode a {
    color: inherit; /* Inherit color from body for unified color */
}

html.night-mode .category-item {
    background-color: #3a3a3a; /* Darker background for category items */
    color: #e0e0e0;
    border-color: #555;
}

html.night-mode .category-item:hover {
    background-color: #4a4a4a; /* Hover effect for dark mode */
}

html.night-mode main section {
    background-color: #2a2a2a;
    box-shadow: 0 2px 5px rgba(255,255,255,0.1);
}

html.night-mode h2 {
    border-bottom: 1px solid #555;
}

html.night-mode .post-list-item {
    background: #2a2a2a;
    box-shadow: 0 2px 5px rgba(255,255,255,0.1);
}

html.night-mode .post-list-item:hover {
    box-shadow: 0 8px 16px rgba(255,255,255,0.2);
}

html.night-mode .post-list-item a {
    color: #e0e0e0;
}

html.night-mode .post-list-item .post-date,
html.night-mode .post-list-item .snippet {
    color: #bbb;
}

html.night-mode .back-link {
    color: #90caf9;
    border-bottom: 1px dotted #90caf9;
}

html.night-mode .back-link:hover {
    color: #add8e6;
    border-bottom-style: solid;
}

html.night-mode .pagination .page-link {
    color: #e0e0e0;
    background-color: #3a3a3a;
    border: 1px solid #555;
    box-shadow: 0 1px 3px rgba(255,255,255,0.05);
}

html.night-mode .pagination .page-link:hover {
    color: #fff;
    background-color: #4a4a4a;
    border-color: #777;
    box-shadow: 0 2px 8px rgba(255,255,255,0.1);
}

html.night-mode .pagination .page-link.current {
    color: #fff;
    background-color: #777;
    border-color: #777;
    box-shadow: 0 2px 8px rgba(255,255,255,0.15);
}

html.night-mode .pagination .page-link.current:hover {
    box-shadow: 0 4px 15px rgba(255,255,255,0.25);
}

html.night-mode .author-separator {
    border-top: 1px solid #555;
}

html.night-mode .sub-categories a {
    color: #e0e0e0;
    background-color: #3a3a3a;
}

html.night-mode .sub-categories a:hover {
    background-color: #4a4a4a;
    color: #fff;
}

html.night-mode .sub-categories a.active {
    background-color: #4a4a4a;
    color: #fff;
}

html.night-mode .download-button {
    background-color: #555;
    border-color: #555;
}

html.night-mode .download-button:hover {
    background-color: #666;
    border-color: #666;
}

html.night-mode .post-image-wide,
html.night-mode .card-layout .post-list-item .post-image {
    filter: brightness(0.7) contrast(1.2);
}

html.night-mode .card-layout .post-list-item-vertical .post-item-header,
html.night-mode .card-layout .post-list-item-vertical .post-summary {
    text-shadow: 1px 1px 5px rgba(0,0,0,1);
}

/* Image styling for diary entries */
.diary-entry .image-wrap img {
    border-radius: 15px; /* Add rounded corners */
}

.diary-entry .image-wrap {
    display: block;
    max-width: 24%;
    margin-bottom: 15px;
}

.diary-entry .image-wrap.left {
    margin-right: 15px;
}

.diary-entry .image-wrap.right {
    margin-left: 15px;
}

/* Mobile adjustments: reduce portrait card image height */
@media (max-width: 768px) {
    .card-layout .post-list-item-vertical .post-image-slideshow {
        height: 220px;
    }
}

/* Style for status index display in the list */
.status-index-display {
    display: inline-block;
    margin-left: 10px; /* Add some space between title and status */
    font-size: 0.9em; /* Slightly smaller than the title */
    vertical-align: middle; /* Align with the middle of the text */
}

/* Circle Rating Styles */
.circle-rating {
    display: inline-flex; /* Use flexbox to align circles */
    align-items: center;
    gap: 2px; /* Space between circles */
    vertical-align: middle; /* Align with text */
}

.circle-rating .circle {
    width: 0.8em; /* Size of the circle */
    height: 0.8em;
    border-radius: 50%; /* Make it a circle */
    border: 1px solid #ccc; /* Border for empty circles */
    background-color: transparent; /* Default empty */
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
}

.circle-rating .circle.filled {
    background-color: #333; /* Color for filled circles (black/dark gray) */
    border-color: #333;
}

.circle-rating .circle.half-filled {
    background: linear-gradient(to right, #333 50%, transparent 50%);
    border-color: #333; /* Border color for half-filled (black/dark gray) */
}

/* Night mode adjustments for circle rating */
html.night-mode .circle-rating .circle {
    border-color: #888; /* Lighter gray for borders in night mode */
}

html.night-mode .circle-rating .circle.filled {
    background-color: #eee; /* Light gray for filled circles in night mode */
    border-color: #eee;
}

html.night-mode .circle-rating .circle.half-filled {
    background: linear-gradient(to right, #eee 50%, transparent 50%);
    border-color: #eee;
}

/* Header Buttons */
#logoutBtn {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 8px 16px;
    background: #333;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-family: inherit;
    font-size: 1rem; /* Consistent font size */
}

#logoutBtn:hover {
    background: #000;
}

#nightModeToggle {
    position: fixed; /* Stick to the viewport */
    top: 50%; /* Center vertically */
    right: 0; /* Attach to the right edge */
    transform: translateY(-50%); /* Fine-tune vertical centering */
    writing-mode: vertical-rl; /* Vertical text */
    text-orientation: mixed;
    padding: 10px 5px; /* Adjust padding for vertical layout */
    border-radius: 8px 0 0 8px; /* Rounded corners on the left side */
    z-index: 1000; /* Ensure it's on top of other content */
    font-size: 0.9rem;
    background: #333;
    color: white;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
    font-family: inherit;
}

#nightModeToggle:hover {
    background: #000;
}

/* Adjustments for night mode buttons */
html.night-mode #nightModeToggle, html.night-mode #logoutBtn, html.night-mode .header-button {
    background: #555;
    color: #f0f0f0;
}

html.night-mode #nightModeToggle:hover, html.night-mode #logoutBtn:hover, html.night-mode .header-button:hover {
    background: #777;
}

.header-button {
    position: absolute;
    top: 20px;
    right: 100px; /* Adjust right position to not overlap with nightModeToggle */
    padding: 8px 16px;
    background: #333;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-family: inherit;
    font-size: 1rem;
    text-decoration: none; /* Remove underline for link */
    line-height: 1; /* Align text vertically */
}

.header-button:hover {
    background: #000;
}

/* Responsive adjustments for header buttons */

@media screen and (max-width: 640px) {
    #logoutBtn {
        position: fixed; /* Stick to the viewport */
        top: calc(12px + env(safe-area-inset-top, 0px)); /* Respect safe area */
        right: 0; /* Attach to the right edge */
        writing-mode: vertical-rl; /* Vertical text */
        text-orientation: mixed;
        padding: 10px 6px; /* Adjust padding for vertical layout */
        border-radius: 8px 0 0 8px; /* Rounded corners on the left side */
        z-index: 1000; /* Ensure it's on top of other content */
        font-size: 0.9rem; /* Comfortable size for mobile vertical */
    }
}


/* Timeline Styles */
.timeline {
    position: relative;
    padding: 20px 0;
    margin-top: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 4px;
    background-color: #e0e0e0;
    left: 50%;
    margin-left: -2px;
}

.timeline-item {
    margin-bottom: 50px; /* Increased spacing between items */
    position: relative;
    width: 50%;
    padding: 10px 40px;
    box-sizing: border-box; /* Include padding in width calculation */
}

.timeline-item:nth-child(odd) {
    left: 0;
    text-align: left;
}

.timeline-item:nth-child(even) {
    left: 50%;
    text-align: left; /* Ensure even items are left-aligned */
}

.timeline-item::after { /* Circle on the timeline */
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: #666; /* Neutral gray for day mode */
    top: 20px;
    z-index: 1;
}

.timeline-item:nth-child(odd)::after {
    left: -8px; /* Position circle on the left of odd items */
}

.timeline-item:nth-child(even)::after {
    left: -8px; /* Position circle on the left of even items */
}

.timeline-icon { /* For icons */
    position: absolute;
    top: 12px;
    font-size: 1.5em;
    color: #666; /* Neutral gray for day mode */
    z-index: 1;
}

.timeline-item:nth-child(odd) .timeline-icon {
    left: 10px; /* Position icon on the left of odd items */
}

.timeline-item:nth-child(even) .timeline-icon {
    left: 10px; /* Position icon on the left of even items */
}

.timeline-date {
    font-size: 1.1em;
    font-weight: bold;
    color: #555;
    margin-bottom: 5px;
}

.timeline-item:nth-child(odd) .timeline-date {
    padding-right: 0;
    padding-left: 20px;
}

.timeline-item:nth-child(even) .timeline-date {
    padding-left: 20px;
}

.timeline-content {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-top: 10px;
    position: relative; /* Needed for arrow */
}

.timeline-item:nth-child(odd) .timeline-content {
    margin-right: 0;
    margin-left: 20px;
}

.timeline-item:nth-child(even) .timeline-content {
    margin-left: 20px;
}

/* Speech bubble arrow for content */
.timeline-item:nth-child(odd) .timeline-content::after {
    content: '';
    position: absolute;
    top: 20px;
    left: -10px;
    border: solid transparent;
    border-width: 10px;
    border-right-color: #f9f9f9;
}

.timeline-item:nth-child(even) .timeline-content::after {
    content: '';
    position: absolute;
    top: 20px;
    left: -10px;
    border: solid transparent;
    border-width: 10px;
    border-right-color: #f9f9f9;
}

.timeline-content h3 {
    margin-top: 0;
    color: #333;
}

.timeline-content p {
    font-size: 0.95em;
    line-height: 1.6;
}

/* Night mode adjustments for timeline */
html.night-mode .timeline::before {
    background-color: #444;
}

html.night-mode .timeline-item::after {
    background-color: #999; /* Neutral gray for night mode */
}

html.night-mode .timeline-icon {
    color: #999; /* Neutral gray for night mode */
}

html.night-mode .timeline-date {
    color: #bbb;
}

html.night-mode .timeline-content {
    background-color: #333;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

html.night-mode .timeline-item:nth-child(odd) .timeline-content::after {
    border-right-color: #333;
    border-left-color: transparent;
}

html.night-mode .timeline-item:nth-child(even) .timeline-content::after {
    border-right-color: #333;
}

html.night-mode .timeline-content h3 {
    color: #eee;
}

html.night-mode .timeline-content p {
    color: #ccc;
}

/* Responsive adjustments for timeline */
@media (max-width: 768px) {
    .timeline::before {
        left: 30px; /* Move timeline line slightly to the right */
    }

    .timeline-item {
        width: 100%;
        padding-left: 120px; /* Increase left padding to accommodate wider date */
        padding-right: 10px;
        left: 0 !important;
        text-align: left !important;
    }

    .timeline-item::after {
        left: 22px; /* Adjust circle position to align with new timeline line */
    }

    .timeline-icon {
        left: 20px; /* Adjust icon position to align with new timeline line */
    }

    .timeline-item:nth-child(odd) .timeline-date,
    .timeline-item:nth-child(even) .timeline-date {
        padding-right: 0;
        padding-left: 0;
        position: absolute;
        left: 110px; /* Adjust date position to align with new left padding */
        top: 10px;
        transform: translateX(-100%);
        width: 90px; /* Increase width for better display */
        text-align: right;
    }

    .timeline-item:nth-child(odd) .timeline-content,
    .timeline-item:nth-child(even) .timeline-content {
        margin-left: 0;
        margin-right: 0;
    }

    .timeline-item:nth-child(odd) .timeline-content::after {
        left: 10px; /* Adjust arrow position for mobile */
        right: auto;
        border-left-color: transparent;
        border-right-color: #f9f9f9;
    }

    html.night-mode .timeline-item:nth-child(odd) .timeline-content::after {
        border-right-color: #333;
    }
}
/* Responsive adjustments for header buttons */
@media (max-width: 768px) {
    #logoutBtn {
        right: 10px; /* Adjust position for mobile */
        padding: 6px 12px; /* Slightly smaller padding */
    }

    .header-button-left {
        left: 10px; /* Adjust position for mobile */
        padding: 6px 12px; /* Slightly smaller padding */
    }

    /* Move Back-to-Home button to the top-right on mobile */
    .header-button-left[href="index.html"],
    .header-button-left[href="../index.html"] {
        left: auto;
        right: 10px;
    }
}

.header-button-left {
    position: absolute;
    top: 20px;
    left: 20px;
    padding: 8px 16px;
    background: #333;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-family: inherit;
    font-size: 1rem;
    text-decoration: none; /* Remove underline for link */
    line-height: 1; /* Align text vertically */
}

.header-button-left:hover {
    background: #000;
}

html.night-mode .header-button-left {
    background: #555;
    color: #f0f0f0;
}

html.night-mode .header-button-left:hover {
    background: #777;
}

/* Position Back-to-Home header button at top-right */
.header-button-left[href="index.html"],
.header-button-left[href="../index.html"] {
    left: auto;
    right: 20px;
}

body, h1, h2, h3, h4, h5, h6, p, a, li, span, div, pre, code, article {
    font-family: 'AR PL UKai CN', "华文楷体", KaiTi, sans-serif;
}