/* 重置所有元素的外边距和内边距 */
* {
    margin: 0;
    padding: 0;
    line-height: 0;
    cursor: none; /* 隐藏原生鼠标指针 */
}

/* 全局滚动控制 - 核心修复 */
html, body {
    width: 100%;
    overflow-x: hidden; /* 彻底禁止横向滚动 */
    overflow-y: auto;   /* 保留纵向滚动功能 */
    box-sizing: border-box;
}

*, *::before, *::after {
    box-sizing: inherit; /* 统一盒模型 */
}

/* 图片容器，设置为相对定位 */
.image-container {
    position: relative;
    display: inline-block;
    max-width: 100vw; /* 限制最大宽度为视口宽度 */
}

/* 图片样式，自适应宽度 */
.image-container img {
    max-width: 100%;
    height: auto;
}

/* 嵌套网格的特定类名 */
.nested-grid {
    display: grid;
    grid-template-columns: 534fr 79fr 104fr;
    grid-template-rows: 95fr 233fr 64fr;
    gap: 0;
}

.nested-grid-1 {
    display: grid;
    grid-template-columns: 5138fr 2025fr 1441fr;
    grid-template-rows: 2993fr 522fr 1165fr;
    gap: 0;
}

.nested-grid-2 {
    display: grid;
    grid-template-columns: 209fr 18fr 209fr 18fr 209fr 18fr 209fr 18fr 209fr 18fr 209fr 18fr 209fr 18fr 209fr 18fr 209fr;
    gap: 0;
}

.nested-grid-3 {
    display: grid;
    grid-template-columns: 87fr 51fr 101fr;
    grid-template-rows: 379fr 197fr 247fr;
    gap: 0;
}

.nested-grid-level2 {
    display: grid;
    grid-template-columns: 514fr 415fr 505fr;
    grid-template-rows: 98fr 161fr 1311fr;
    gap: 0;
}

/* 网格覆盖层样式 */
.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    gap: 0;
    z-index: 1;
}

/* 网格项样式 */
.grid-item {
    position: relative;
}

/* 嵌套网格项样式 */
.nested-grid-item,
.nested-grid-item-1,
.nested-grid-item-2,
.nested-grid-item-3,
.nested-grid-item-level2 {
    position: relative;
    display: grid;
    place-items: center;
}

@font-face {
    font-family: '思源宋体SC-Bold';
    src: url('fonts/思源宋体SC-Bold.otf') format('opentype');
    font-weight: bold;
    font-style: normal;
}

.overlay-link {
    color: black;
    z-index: 2;
    writing-mode: vertical-rl;
    text-orientation: upright;
    font-size: 6vw;
    line-height: 1.2;
    height: auto;
    font-family: '思源宋体SC-Bold', serif;
    font-weight: bold;
    background-color: white;
    text-decoration: none;
}

.overlay-link:hover {
    color: gray;
}

.overlay-link:active,
.overlay-link:focus {
    color: gray;
    background-color: white;
}

/* 点击量数字样式 */
.click-digit {
    font-family: '思源宋体SC-Bold', serif;
    font-weight: 900;
}

.click-digit img {
    max-width: 100%;
    height: auto;
}

.click-digit span {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    line-height: 1;
    font-size: 1.5vw;
}

/* 自定义鼠标样式 */
#custom-cursor {
    position: absolute;
    pointer-events: none;
    z-index: 9999;
    width: 4.5vw;
    height: 4.5vw;
    object-fit: contain;
    animation: gifAnimation 1s infinite;
    animation-play-state: paused;
}

@keyframes gifAnimation {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 0 0;
    }
}

#stop-cursor {
    position: absolute;
    pointer-events: none;
    z-index: 9999;
    width: 4vw;
    height: 4vw;
    object-fit: contain;
}

/* 日历容器样式 */
#calendar-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    margin-top: 1.1vw;
    margin-left: 0.15vw;
}

#calendar-header {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 1vw;
    width: 20%;
    box-sizing: border-box;
    z-index: 2;
    margin-top: -1.5vw;
}

#year-display {
    margin-bottom: 0.7vw;
    margin-left: 0.15vw;
    white-space: nowrap;
    display: flex;
    gap: 0.1vw;
    align-items: flex-end;
}

#year-display img.year-digit-image {
    height: auto;
    width: auto;
    max-height: 1.5vw;
}

#year-display img.year-character-image {
    height: auto;
    width: auto;
    max-height: 1.9vw;
    margin-left: 0.05vw;
}

#month-display {
    margin-top: -0.2vw;
    display: inline-flex;
    gap: 0.05vw;
    margin-left: 0.4vw;
}

#month-display img {
    height: auto;
    width: auto;
    height: 3vw;
    max-height: 3vw;
    max-width: 2.5vw;
}

.calendar-wrapper {
    padding: 0.3vw;
    background-color: white;
    border: 0.2vw solid black;
    width: 75%;
    height: 90%;
    box-sizing: border-box;
    margin-left: 13%;
    cursor: pointer;
}

#calendar-table {
    width: 100%;
    height: 100%;
    border-collapse: separate;
    border-spacing: 0.3vw;
    table-layout: fixed;
    background-color: black;
}

#calendar-table td {
    text-align: center;
    box-sizing: border-box;
    font-size: 1vw;
    padding: 0.2vw;
    cursor: pointer;
    background-color: black;
    z-index: 3;
    color: white;
    border: 0.1vw solid white;
    white-space: pre-wrap;
    height: auto;
    font-family: '思源宋体SC-Bold', serif;
}

#calendar-table td img {
    pointer-events: none;
    width: 100%;
    height: auto;
}

#calendar-table td:hover {
    box-shadow: inset 0 0 0 0.05vw white;
    color: black;
}

#calendar-table td:not([data-date]) {
    cursor: default;
}

#calendar-table td:not([data-date]):hover {
    background-color: black;
    color: white;
    box-shadow: none;
}

#event-display {
    position: absolute;
    top: -15%;
    left: 99%;
    background-color: white;
    border: 0.2vw solid black; 
    display: none;
    z-index: 2;
    box-sizing: border-box;
    width: 10.3vw; 
    max-width: 10.3vw; 
    height: 16.5vw; 
    max-height: 16.5vw; 
    overflow-x: auto;
    font-size: 1.1vw;
    font-family: '思源宋体SC-Bold', serif;
}


#event-image-container {
    padding: 0;
}

#event-image {
    width: 100%;
    height: auto;
    margin-bottom: 0.3vw;
}

#event-content-container {
    padding: 1vw;
    position: relative;
}

#event-content {
    line-height: 1.5;
    text-decoration: none;
}

#event-content::after {
    content: "";
    position: absolute;
    left: 1vw;
    right: 1vw;
    height: 0.1vw;
    background-color: black;
    top: 2.2em;
    box-shadow: 0 1.5em 0 black, 0 3em 0 black, 0 4.5em 0 black, 0 6em 0 black, 0 7.5em 0 black, 0 9em 0 black;
}

/* 当天日期样式 */
#calendar-table td.today-cell {
    background-color: white;
}

.white-number {
    color: white;
}

/* 建筑图片样式 */
.nested-grid-item-level2 img {
    width: 100%;
    height: 100%;
    object-fit: fill;
}

/* 可点击方块样式 */
#clickable-square {
    width: 73%;
    height: 31.2%;
    background-color: rgba(0, 0, 0, 0);
    cursor: pointer;
    margin-top: -121%;
    margin-left: -2%;
}