:root {
    --bg-gray: #C0C0C0;
    --bg-gray-light: #ECE9D8;
    --main-blue: #0153E3;
    --primary-color: #ff8a00;
    --primary-light: #ffead1;
    --primary-dark: #e67e00;
    --text-color: #333;
    --text-color-secondary: #666;
    --background-color: #fafafa;
    --card-background: #ffffff;
    --border-radius: 12px;
    --box-shadow: 0 3px 8px rgba(0, 0, 0, .05);
    --transition: all .25s ease;
    --box-shadow-hover: 0 10px 25px rgba(0, 0, 0, .1)
}

body {
    min-width: fit-content
}

.game-window {
    background: var(--bg-gray);
    font-size: 0;
    border: solid 2px var(--main-blue);
    border-radius: 6px 6px 0 0;
    width: fit-content;
    margin: 0 auto
}

#game {
    background: var(--bg-gray);
    touch-action: manipulation
}

.game-window-anno {
    font-size: 12px;
    text-align: center;
    margin-bottom: 24px
}

.window-title-bar {
    font-size: 14px;
    color: #fff;
    padding: 8px 12px 4px;
    margin: 0;
    box-sizing: border-box;
    border-bottom: solid 2px var(--main-blue);
    border-radius: 4px 4px 0 0;
    background: linear-gradient(180deg,#3B93FD 4.53%,#0153E3 15.78%,#0153E3 57.34%,#0867FE 96.95%)
}

.menu {
    position: relative;
    border-bottom: 1px solid #D4D1CA;
    background: var(--bg-gray-light)
}

button {
    outline: none;
    border: 0;
    color: #000;
    cursor: pointer
}

.menu>button {
    padding: 2px 8px
}

.menu>button,.menu-popup>button,.plain-link>button {
    font-size: 14px;
    background: transparent
}

.menu-popup {
    visibility: hidden;
    position: absolute;
    top: 24px;
    left: 0;
    display: flex;
    flex-direction: column;
    width: 200px;
    background-color: #fff;
    border: 1px solid #85857B;
    box-shadow: 3px 3px 2px #0000004d;
    padding: 4px
}

.menu-popup>hr {
    border-bottom: 1px solid #85857B;
    border-top: 0;
    border-left: 0;
    border-right: 0;
    width: 100%;
    margin: 4px 0
}

.menu-popup>button {
    text-align: left;
    padding: 2px
}

.menu>button:hover,.menu-popup>button:hover {
    color: #fff;
    background-color: #3368c4
}

ul li,ol li {
    margin: 10px 0
}

a {
    text-decoration: none;
    color: #0073e6
}

a:hover {
    text-decoration: underline
}

html,body {
    padding: 0;
    margin: 0;
    font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;
    line-height: 1.6;
    font-size: 16px
}

.container {
    max-width: 1200px;
    margin: 0 auto
}

.header {
    background-color: #fff;
    color: var(--text-color);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 5px #0000000d
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px
}

.header span {
    margin-right: 20px
}

.logo {
    height: 42px;
    width: auto;
    margin-right: 40px
}

.navContainer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-grow: 1
}

.desktopNav {
    display: flex;
    align-items: center
}

.desktopNav a {
    color: var(--text-color);
    margin-right: 24px;
    padding: 6px 4px;
    position: relative
}

.desktopNav a:after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width .3s ease
}

.desktopNav a:hover:after {
    width: 100%
}

.desktopNav .current {
    color: var(--primary-color);
    font-weight: 600
}

.desktopNav .current:after {
    width: 100%
}

.header a:hover {
    color: var(--primary-color);
    text-decoration: none
}

.mobileMenuButton {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 10
}

.hamburger {
    display: block;
    position: relative;
    width: 18px;
    height: 2px;
    background: var(--text-color);
    transition: background .3s ease;
    margin-right: 0!important
}

.hamburger:before,.hamburger:after {
    content: "";
    position: absolute;
    width: 18px;
    height: 2px;
    background: var(--text-color);
    left: 0;
    transition: transform .3s ease
}

.hamburger:before {
    top: -6px
}

.hamburger:after {
    bottom: -6px
}

.mobileMenuButton.open .hamburger {
    background: transparent
}

.mobileMenuButton.open .hamburger:before {
    transform: rotate(45deg) translate(5px,5px)
}

.mobileMenuButton.open .hamburger:after {
    transform: rotate(-45deg) translate(5px,-5px)
}

.mobileMenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #fff;
    box-shadow: 0 4px 8px #0000001a;
    z-index: 5;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease,padding .3s ease
}

.mobileMenu.open {
    max-height: 300px;
    padding: 10px 0
}

.mobileNav {
    display: flex;
    flex-direction: column;
    padding: 0 20px
}

.mobileNav a,.mobileNav span {
    padding: 12px 0;
    margin: 0;
    border-bottom: 1px solid #eee;
    display: block;
    width: 100%
}

.mobileNav a:last-child {
    border-bottom: none
}

.mobileNav .current {
    color: var(--primary-color);
    font-weight: 700
}

main {
    padding: 20px;
    background-color: #f5f5f6;
    min-height: 100vh;
    min-width: fit-content
}

main .container {
    width: fit-content
}

.game-card {
    width: fit-content;
    max-width: 960px;
    min-height: 800px;
    margin: auto;
    padding: 16px;
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 0 10px #0000001a
}

.footer {
    background-color: #c7c7c7;
    color: var(--text-color-secondary);
    text-align: center;
    padding: 1em;
    width: 100%;
    box-sizing: border-box
}

.copyright {
    margin-top: 12px;
    color: var(--text-color-secondary);
    font-size: 14px
}

.bd a {
    color: var(--text-color-secondary);
    position: relative;
    margin-right: 27px
}

.bd {
    margin-top: 5px;
    font-size: 14px
}

.bd a:after {
    position: absolute;
    content: "";
    width: 1px;
    height: 5px;
    top: 50%;
    margin-top: -2.5px;
    right: -16px;
    background: var(--text-color-secondary)
}

.bd a:last-child {
    margin-right: 0
}

.bd a:last-child:after {
    display: none
}

@media (max-width: 768px) {
    .container {
        padding:0 20px
    }

    .header {
        padding: 10px 0
    }

    .navContainer {
        gap: 16px
    }

    .desktopNav {
        display: none
    }

    .mobileMenuButton,.mobileMenu {
        display: block
    }

    main {
        padding: 10px 0
    }

    main .container {
        padding: 16px
    }

    .game-card {
        padding: 0;
        border: none;
        box-shadow: none;
        background: transparent
    }

    .footer {
        padding: .5em
    }

    .bd a {
        margin-right: 20px
    }

    .bd a:after {
        right: -10px
    }
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1
}

.modal-content {
    background-color: var(--bg-gray-light)!important;
    min-width: 300px;
    margin: 160px auto 0!important;
    position: relative;
    box-shadow: 3px 3px 2px #0000004d
}

.close {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 26px;
    padding: 0;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    cursor: pointer;
    color: #fff;
    border-radius: 4px;
    border: 1px solid #FFF;
    background: linear-gradient(304deg,#E34C20 20.59%,#EB8B6E 93.75%)
}

.modal-content label {
    font-size: 14px;
    margin-left: 8px
}

.modal-content p {
    font-size: 14px;
    margin: 8px
}

.modal-content input {
    padding: 4px 6px;
    margin: 8px 8px 0;
    border: 1px solid #05467F;
    font-size: 14px
}

.modal-content input:focus {
    outline: 2px solid #AFC9ED
}

.custom-input {
    width: 50px
}

.modal-footer {
    display: flex;
    justify-content: flex-end
}

.player-name-input {
    box-sizing: border-box;
    margin-top: 0
}

.modal-content button {
    padding: 4px 16px;
    color: #000;
    cursor: pointer;
    margin: 8px;
    border-radius: 4px;
    border: 1px solid #05467F;
    background: #F3F2EE;
    font-size: 14px
}

.modal-content button:hover,.modal-content button:focus {
    outline: 2px solid #AFC9ED
}

.modal-content .row {
    display: flex;
    margin: 8px 0
}

.modal-content .col-6 {
    flex: 0 0 50%;
    max-width: 50%
}

.modal-content .col-6 p {
    margin: 0 8px
}

.modal-content .col-5 {
    flex: 0 0 43.67%;
    max-width: 43.67%
}

#stats-best-scores {
    padding: 0;
    margin: 0;
    min-width: 160px
}

#stats-best-scores .row {
    align-items: center;
    gap: 8px
}

.stats-info-col {
    min-width: 140px
}

.modal-content .center {
    text-align: center;
    margin: 8px auto
}

.modal-content .bold {
    font-weight: 700
}

.box {
    margin: 16px 0
}

.stats-modal-content {
    padding: 0 16px;
    font-size: 14px
}

.leaderboard {
    display: flex;
    justify-content: space-around;
    text-align: center
}

.leaderboard-section {
    flex: 1;
    border: 1px solid #333;
    padding: 10px;
    margin: 10px;
    width: 100%;
    box-sizing: border-box
}

.leaderboard h3 {
    font-size: 1.2rem
}

.leaderboard ul {
    list-style: none;
    padding: 0
}

.leaderboard li {
    font-size: 1rem;
    margin: 5px
}

.btn {
    margin-left: 10px;
    padding: 4px 8px;
    background-color: #e0e0e0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700
}

.btn:hover {
    background-color: #e6e6e6
}

.time-range-buttons {
    display: flex;
    justify-content: center;
    margin-bottom: 20px
}

.time-range-buttons button {
    margin: 0 10px;
    padding: 8px 16px;
    background-color: #e0e0e0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700
}

.time-range-buttons button:hover {
    background-color: #e6e6e6
}

.time-range-buttons button.selected {
    background-color: #0073e6;
    color: #fff
}

.error {
    color: red
}

@media screen and (max-width: 480px) {
    .leaderboard {
        flex-direction:column
    }

    .leaderboard-section {
        margin: 10px 0
    }
}

/* 日夜模式 */
body {
    transition: background-color 0.5s ease, color 0.5s ease;
}

body.dark-mode {
    background-color: #1a1a2e !important;
    color: #9E9E9E  !important;
}

body.dark-mode main {
    background-color: #1a1a2e !important;
}

main {
    transition: background-color 0.5s ease;
}

.header {
    transition: background-color 0.5s ease, color 0.5s ease;
}

.footer {
    transition: background-color 0.5s ease, color 0.5s ease;
}

.desktopNav a,
.mobileNav a {
    transition: color 0.5s ease;
}

.hamburger,
.hamburger:before,
.hamburger:after {
    transition: background-color 0.5s ease;
}

body.dark-mode .header {
    background-color: #16213e !important;
    color: #eee !important;
}

body.dark-mode .header a,
body.dark-mode .desktopNav a,
body.dark-mode .header span {
    color: #eee !important;
}

body.dark-mode .mobileMenu {
    background-color: #16213e !important;
}

body.dark-mode .mobileNav a,
body.dark-mode .mobileNav span {
    color: #eee !important;
    border-bottom-color: #0f3460 !important;
}

body.dark-mode .hamburger,
body.dark-mode .hamburger:before,
body.dark-mode .hamburger:after {
    background-color: #eee !important;
}

body.dark-mode .footer {
    background-color: #16213e !important;
    color: #999 !important;
}

body.dark-mode .copyright,
body.dark-mode .bd a {
    color: #999 !important;
}

body.dark-mode .bd a:after {
    background: #999 !important;
}

body.dark-mode .text-color {
    color: #eee !important;
}

body.dark-mode .text-color-secondary {
    color: #999 !important;
}

/* 日夜模式切换按钮 */
.theme-toggle {
    position: fixed;
    top: 10px;
    right: 10px;
    padding: 8px 16px;
    background-color: #333;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    z-index: 1000;
    transition: background-color 0.3s;
}

.theme-toggle:hover {
    background-color: #555;
}

body.dark-mode .theme-toggle {
    background-color: #eee;
    color: #333;
}

body.dark-mode .theme-toggle:hover {
    background-color: #ccc;
}
