@font-face {
    font-family: 'CustomFont';
    src: url('font/font.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}
body {
    font-family: 'CustomFont', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: #ffffff;
}

header,
footer {
    background: #333;
    color: #fff;
    padding: 1em;
    text-align: center;
}

main {
    padding: 2em;
}

.top-images-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    margin-top: 6em;
    position: relative;
    height: 250px;
    /* Adjust as needed */
}

.left-images {
    display: flex;
    flex-direction: column;
    position: relative;
    margin-right: 30px;
}

.bun-img {
    width: 180px;
    /* Adjust as needed */
    height: auto;
    margin-bottom: 10px;
    cursor: pointer;
    transition: transform 0.2s;
}

.bun-img.shrink {
    transform: scale(0.7);
}

.left-bottom-img {
    width: 180px;
    /* Adjust as needed */
    height: auto;
    margin-top: 0;
}

.sis-img {
    width: 320px;
    /* Adjust as needed */
    height: auto;
    align-self: flex-start;
}

.pinyin-image {
    display: flex;
    justify-content: center;
    /* 水平居中 */
    align-items: center;
    /* 垂直居中（如果需要） */
    width: 100%;
    /* 确保容器占满宽度 */
    margin-top: -1em;
    margin-bottom: 3em;
}

.game-image {
    display: flex;
    justify-content: center;
    /* 水平居中 */
    align-items: center;
    /* 垂直居中（如果需要） */
    width: 100%;
    /* 确保容器占满宽度 */
    margin-top: 3em;
    margin-bottom: 3em;
}

@keyframes flicker {
    0% {
        color: #ffb3c2;
        /* 几乎透明 */
    }

    50% {
        color: rgba(0, 0, 0, 1);
        /* 纯黑色 */
    }

    100% {
        color: #ffb3c2;
        /* 几乎透明 */
    }
}

.flicker-text {
    animation: flicker 3s infinite;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-top: 3em;
    margin-bottom: 3em;
    -webkit-animation: flicker 3s infinite;
}

button {
    padding: 0.5em 1em;
    font-size: 1em;
    font-family: 'CustomFont', Arial, sans-serif;
    align-items: center;
    background-color: #dddddd;
    /* Button background color */
    color: #000000;
    /* Text color */
    border: none;
    /* Remove default border */
    border-radius: 5px;
    /* Rounded corners */
    cursor: pointer;
    /* Pointer cursor on hover */
    transition: background-color 0.3s;
    /* Smooth transition for hover effect */
}

button:hover:not(:disabled) {
    background-color: #ffb3c2;
    /* Darker background on hover */
    color: #000000;
    /* Text color */
}

/* Confirm button animation */
#confirmBtn.active:not(:disabled):not(:hover) {
    animation: buttonBounce 1s infinite alternate;
    -webkit-animation: buttonBounce 1s infinite alternate;
}

@keyframes buttonBounce {
    0% {
        background-color: #dddddd;
    }
    100% {
        background-color: #ffb3c2;
    }
}

button:disabled {
    color: #808080;
    /* Grey text color when disabled */
    cursor: not-allowed;
    /* Not-allowed cursor when disabled */
}

canvas {
    width: 100%;
    max-width: 1344px;
    height: auto;
    display: block;
    margin: 0 auto;
    border: 2px solid #333;
    justify-content: center;
    align-items: center;
}

.jigsaw-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    /* Stack vertically */
    justify-content: center;
    align-items: center;
    gap: 2em;
    margin: 2em auto;
    min-height: calc(100vh - 8em);
    box-sizing: border-box;
}

.jigsaw {
    width: 100%;
    max-width: 70vw;
    height: auto;
    border: 2px solid #333;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
}

.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1em;
    margin-top: 2em;
}

#floatingTimer {
    font-size: 1.5em;
    font-family: monospace;
}

.ranking-block {
    background: #f8f8f8;
    border-radius: 8px;
    padding: 1em 2em;
    max-width: 600px;
    margin: 0 auto;
}

.ranking-block>div {
    width: 220px;
}

.ranking-block h3 {
    margin-bottom: 0.5em;
    font-size: 1.1em;
}

/* 分页容器样式 - 固定定位在右侧 */
.page-nav {
    position: fixed;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    display: none;
    /* 初始隐藏，按下任意键后显示 */
    flex-direction: column;
    gap: 20px;
    z-index: 1000;
}

/* 分页按钮样式 - 小图 */
.page-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    position: relative;
}

/* 选中状态 - 放大 */
.page-btn.active {
    transform: scale(1.2);
    border-color: #ffb3c2;
    box-shadow: 0 6px 15px rgba(255, 107, 107, 0.4);
    z-index: 1001;
}

/* Display image on hover for first page button */
.page-nav .page-btn:first-child:hover {
    background: url('images/b1.png') no-repeat center center;
    background-size: 110%;
    color: transparent;
}

.page-nav .page-btn:nth-child(2):hover {
    background: url('images/b2.png') no-repeat center center;
    background-size: 110%;
    color: transparent;
}

.page-nav .page-btn:nth-child(3):hover {
    background: url('images/b3.png') no-repeat center center;
    background-size: 110%;
    color: transparent;
}

.page-nav .page-btn:nth-child(4):hover {
    background: url('images/b4.png') no-repeat center center;
    background-size: 110%;
    color: transparent;
}

.page-nav .page-btn:nth-child(5):hover {
    background: url('images/b5.png') no-repeat center center;
    background-size: 110%;
    color: transparent;
}

.page-nav .page-btn:nth-child(6):hover {
    background: url('images/b6.png') no-repeat center center;
    background-size: 110%;
    color: transparent;
}

/* 分页内容区域 */
.page {
    min-height: 100vh;
    /* 每个分页占满视口高度 */
    width: 100%;
    opacity: 1;
    transition: opacity 0.1s ease;
    scroll-margin-top: 0;
}

/* 平滑滚动到分页 */
html {
    scroll-behavior: smooth;
}

/* 禁用鼠标滚轮滚动 */
body {
    overflow-y: hidden;
    /* 隐藏滚动条，但保留滚动功能 */
    height: 100vh;
    position: relative;
}

.pages-container {
    height: 100vh;
    overflow-y: scroll;
    /* 保留滚动功能但隐藏滚动条 */
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    /* IE和Edge隐藏滚动条 */
    scrollbar-width: none;
    /* Firefox隐藏滚动条 */
}

.pages-container::-webkit-scrollbar {
    display: none;
    /* Chrome、Safari和Opera隐藏滚动条 */
}

/* 浮动控制块样式（拼图页显示） */
.floating-controls {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
}

/* Floating Music Button Styles */
.floating-music-container {
    position: fixed;
    bottom: 330px;
    left: 30px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.floating-music-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: transparent;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: transform 0.3s ease;
    -webkit-border-radius: 50%;
    -moz-border-radius: 50%;
    -ms-border-radius: 50%;
    -o-border-radius: 50%;
    -webkit-transition: transform 0.3s ease;
    -moz-transition: transform 0.3s ease;
    -ms-transition: transform 0.3s ease;
    -o-transition: transform 0.3s ease;
}

.floating-music-btn:hover {
    transform: scale(1.1);
    -webkit-transform: scale(1.1);
    -moz-transform: scale(1.1);
    -ms-transform: scale(1.1);
    -o-transform: scale(1.1);
}

.floating-music-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.floating-music-btn.playing img {
    animation: breatheRotate 1.5s ease-in-out infinite;
    -webkit-animation: breatheRotate 1.5s ease-in-out infinite;
}

@keyframes breatheRotate {
    0% {
        transform: scale(1) rotate(0deg);
        -webkit-transform: scale(1) rotate(0deg);
        -moz-transform: scale(1) rotate(0deg);
        -ms-transform: scale(1) rotate(0deg);
        -o-transform: scale(1) rotate(0deg);
}

    50% {
        transform: scale(3) rotate(180deg);
        -webkit-transform: scale(3) rotate(180deg);
        -moz-transform: scale(3) rotate(180deg);
        -ms-transform: scale(3) rotate(180deg);
        -o-transform: scale(3) rotate(180deg);
    }

    100% {
        transform: scale(1) rotate(360deg);
    }
}

@keyframes attention {
    0% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.2);
    }
    50% {
        transform: scale(1);
    }
    75% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

.floating-music-btn.attention {
    animation: attention 1s ease-in-out;
}

/* Music Text Styles */
.music-text-container {
    width: 60px;
    height: 20px;
    margin-top: 5px;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
}

.music-text {
    color: #666;
    /*Greycolor*/
    font-size: 12px;
    white-space: nowrap;
    position: absolute;
    left: 0;
    transition: transform 0.5s ease;
    /*Fadeeffectonbothends*/
    /* mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent); */
}

/* Animation for scrolling text */
.music-text-container.scrolling .music-text {
    animation: scrollText 12s linear infinite;
    -webkit-animation: scrollText 12s linear infinite;
}

@keyframes scrollText {
    0% {
        transform: translateX(100%);
        -webkit-transform: translateX(100%);
        -moz-transform: translateX(100%);
        -ms-transform: translateX(100%);
        -o-transform: translateX(100%);
    }

    100% {
        transform: translateX(-100%);
        -webkit-transform: translateX(-100%);
        -moz-transform: translateX(-100%);
        -ms-transform: translateX(-100%);
        -o-transform: translateX(-100%);
    }
}

/* 首页特定样式 */
.flicker-text {
    font-size: 32px;
    letter-spacing: 4px;
    transition: opacity 0.3s ease;
}

.flicker-text.hidden {
    opacity: 0;
    pointer-events: none;
}

/* 第二页样式调整 */
.second-page .game-image {
    margin-top: 2em;
}


.new_button {
    background-color: #606060;
    border: none;
    color: white;
    padding: 8px 12px;
    font-size: 14px;
    font-family: 'CustomFont', Arial, sans-serif;
    margin: 4px 2px;
    cursor: pointer;
    border-radius: 4px;
}

.new_button:hover {
    background-color: #808080;
}


.slider {
    -webkit-appearance: none;
    width: 80px;
    height: 6px;
    border-radius: 5px;
    background: #d3d3d3;
    outline: none;
    opacity: 0.7;
    -webkit-transition: .2s;
    transition: opacity .2s;
}