html {
    scroll-behavior: smooth;
}

#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

body {
    overflow: hidden;
}

main {
    flex: 1;
    padding-top: 5.5rem;
    box-sizing: border-box;
    width: 100%;
}

h1, h2, h3, h4, h5, h6, #comments {
    scroll-margin-top: 7rem; /* 与导航栏高度一致 */
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.toc {
    position: fixed;
    top: 54%;
    left: 0;
    max-height: 75%;
    overflow-y: auto;
    transform: translateY(-50%);
    width: 15.625rem;
    padding: 0.625rem;
    border-radius: 0.3125rem;
    background-color: rgba(255, 255, 255, 0.7);
    box-shadow: 0 0.125rem 0.3125rem rgba(0, 0, 0, 0.2);
    z-index: 9999;
}

.content-wrapper {
    background-color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    margin-left: 17.5rem;
    margin-right: 0.3125rem;
}

.content-wrapper h1 {
    text-align: center
}

span#charCountMessage {
    position: absolute;
    bottom: 0.3125rem;
    right: 1.25rem;
    color: grey;
    font-size: 0.8rem;
    pointer-events: none;
}

.toc ul {
    list-style-type: none;
    padding-left: 0;
    margin-bottom: 0;
}

.toc ul ul {
    margin-left: 1.25rem;
}

.toc a {
    color: #333;
    text-decoration: none;
    display: block;
    padding: 0.3125rem 0;
}

.toc a:hover {
    background-color: red;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.25rem;
}

th {
    background-color: rgba(0, 0, 0, 0.55);
    color: pink;
    padding: 0.5rem;
    text-align: left;
    font-weight: bold;
    border-bottom: 0.125rem solid white;
    border-right: 0.0625rem solid white;
}

td {
    background-color: rgba(0, 0, 0, 0.55);
    color: pink;
    padding: 0.5rem;
    border-bottom: 0.0625rem solid white;
    border-right: 0.0625rem solid white;
}

tr:hover {
    background-color: red;
}

th:last-child,
td:last-child {
    border-right: none;
}

pre {
    padding: 0.625rem;
    border-radius: 0.3125rem;
    background-color: rgba(255, 255, 255);
    box-shadow: 0 0.125rem 0.3125rem rgba(0, 0, 0);
    overflow-x: auto;
}

#comments-scroll-container {
    max-width: 100%;
    margin: 0 auto;
    height: 31.25rem;
    overflow-y: auto;
    padding: 0.625rem;
    border: 0.0625rem solid #ddd;
    border-radius: 0.5rem;
    background-color: #f9f9f9;
}

#comments-container {
    padding: 0;
}

.comment-card {
    background-color: pink;
    padding: 0.9375rem;
    margin-bottom: 1.25rem;
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.3125rem rgba(0, 0, 0, 0.1);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.625rem;
}

.comment-author {
    font-weight: bold;
}

.comment-time {
    font-size: 0.9em;
}

.comment-body p {
    font-size: 1em;
    line-height: 1.5;
}

#submit-button {
    padding: 0.625rem 1.25rem;
    margin-top: 1.25rem;
    border: none;
    background-color: pink;
    color: white;
    border-radius: 0.3125rem;
    cursor: pointer;
}

#submit-button:hover {
    background-color: deeppink;
}

#user-comments {
    width: 97.5%;
    padding: 0.5rem;
    border: 0.0625rem solid #ddd;
    border-radius: 0.5rem;
    resize: none;
    position: relative;
}

label[for="user-comments"] {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

#home_a {
    display: inline-block;
    padding: 0.625rem 1.25rem;
    background-color: pink;
    color: white;
    text-decoration: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: background-color 0.3s;
}

#home_a:hover {
    background-color: deeppink;
}

#back-to-top {
    position: fixed;
    bottom: 1.875rem;
    right: 1.875rem;
    width: 2.8125rem;
    height: 2.8125rem;
    background: rgba(0, 0, 0, 0.4);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.25rem;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 9999;
    pointer-events: none;
}

#back-to-top:hover {
    background: rgba(0, 0, 0, 0.7);
}

#back-to-top.show {
    opacity: 1;
    pointer-events: auto;
}
