/* =================== 基础 & 认证界面样式 =================== */
body,
html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Arial', 'Microsoft YaHei', sans-serif;
    overflow: hidden;
    background: #000;
    color: #fff;
    transition: background 0.8s, color 0.8s;
}

#bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    transition: opacity 0.5s ease-in-out;
}

.switch-wave {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 2;
}

.slider-wrapper {
    width: 360px;
    height: 420px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    perspective: 1200px;
    z-index: 1;
    transition: opacity 0.5s ease-in-out;
}

.slider {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.panel {
    position: absolute;
    width: 100%;
    height: 100%;
    padding: 40px;
    box-sizing: border-box;
    border-radius: 20px;
    background: rgba(30, 30, 30, 0.85);
    border: 2px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: all 0.5s;
}

.panel:hover {
    box-shadow: 0 0 50px rgba(255, 255, 255, 0.6);
    transform: translateY(-5px);
}

#register-panel {
    transform: rotateY(180deg);
}

h2 {
    text-align: center;
    margin-bottom: 25px;
    text-shadow: 0 0 10px #fff;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 2px solid #fff;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    font-size: 16px;
    outline: none;
    transition: all 0.3s;
    box-sizing: border-box;
}

input:focus {
    border-color: #fff;
    box-shadow: 0 0 15px #fff;
}

button {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 12px;
    background: #fff;
    color: #000;
    font-weight: bold;
    cursor: pointer;
    font-size: 16px;
    transition: transform 0.1s, box-shadow 0.2s;
    box-shadow: 0 5px #ccc;
}

button:active {
    transform: translateY(3px);
    box-shadow: 0 2px #ccc;
}

.toggle-link {
    display: block;
    margin-top: 15px;
    text-align: center;
    color: #fff;
    cursor: pointer;
    text-decoration: underline;
}

.strength {
    font-size: 14px;
    margin-bottom: 10px;
    height: 16px;
}

.popup {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    padding: 15px 30px;
    background: rgba(0, 0, 0, 0.85);
    border: 2px solid #fff;
    border-radius: 20px;
    text-align: center;
    font-size: 16px;
    z-index: 100;
    color: #fff;
    opacity: 0;
    transition: all 0.3s ease-in-out;
    pointer-events: none;
}

.popup.show {
    transform: translateX(-50%) scale(1);
    opacity: 1;
}

.show-pass-btn {
    position: absolute;
    right: 10px;
    top: 18px;
    transform: translateY(-30%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    transition: background 0.3s;
}

.show-pass-btn:hover {
    background: rgba(255, 255, 255, 1);
}

.show-pass-btn svg {
    width: 16px;
    height: 16px;
    fill: #000;
}

/* =================== 通用 & 场景管理 =================== */
.hidden {
    display: none !important;
}

#auth-screen,
#main-menu-screen,
#game-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 1;
    transition: opacity 0.5s ease-in-out;
}

/* =================== 主菜单样式 ======================== */
#main-menu-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    opacity: 0;
    z-index: 5;

    /* 深灰色放射渐变背景 */
    /* background: radial-gradient(circle, #7e7d7d 0%, #000000 80%); */
}

.taijitu-bg {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 60vh;
    height: 60vh;
    max-width: 600px;
    max-height: 600px;

    opacity: 1;

    filter: brightness(1.05) contrast(1.1) drop-shadow(0 0 15px rgba(255, 255, 255, 0.2));

    animation: rotate-slow 30s linear infinite;
}

@keyframes rotate-slow {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.menu-panel {
    width: 400px;
    padding: 40px;
    box-sizing: border-box;
    border-radius: 20px;
    background: rgba(30, 30, 30, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    text-align: center;
}

.menu-panel h1 {
    font-size: 3em;
    text-shadow: 0 0 15px #fff;
    margin-bottom: 40px;
    color: #fff;
}

.menu-panel button {
    width: 100%;
    padding: 15px;
    margin-bottom: 20px;
    font-size: 18px;
}

.menu-panel button:last-child {
    margin-bottom: 0;
}

#logout-btn {
    background: #555;
    color: #fff;
    box-shadow: 0 5px #333;
}

#logout-btn:active {
    box-shadow: 0 2px #333;
}

/* =================== 成就系统弹窗样式 =================== */
#achievement-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
}

#achievement-modal.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 400px;
    padding: 20px;
    background: rgba(20, 20, 20, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 15px;
    box-shadow: 0 0 50px rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transform: scale(0.9);
    transition: transform 0.3s ease-in-out;
}

#achievement-modal.show .modal-content {
    transform: scale(1);
}

.modal-close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close-btn:hover {
    color: #fff;
}

.achievement-list {
    list-style: none;
    padding: 0;
    max-height: 300px;
    overflow-y: auto;
}

.achievement-item {
    display: flex;
    align-items: center;
    padding: 10px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: background 0.3s;
}

.achievement-item:hover {
    background: rgba(255, 255, 255, 0.2);
}

.achievement-item .icon {
    font-size: 1.5em;
    margin-right: 15px;
}

.achievement-item .details h3 {
    margin: 0 0 5px 0;
}

.achievement-item .details p {
    margin: 0;
    color: #ccc;
}

.achievement-item.locked {
    opacity: 0.6;
}

.achievement-item.locked .details h3 {
    color: #aaa;
}

.achievement-item.locked .details p::after {
    content: " (未解锁)";
    color: #999;
}

/* 成就分页控件样式 */
.achievement-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 15px 0;
    gap: 15px;
}

.page-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.page-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#page-info {
    color: #fff;
    font-size: 14px;
    min-width: 60px;
    text-align: center;
}

/* =================== 游戏界面样式 =================== */
#game-screen {
    opacity: 0;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    background: #111;
}

/* =================== 游戏设置弹窗样式 =================== */
#settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
}

#settings-modal.show {
    opacity: 1;
    pointer-events: auto;
}

.settings-content {
    position: relative;
    width: 90%;
    max-width: 500px;
    padding: 30px;
    background: rgba(20, 20, 20, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    box-shadow: 0 0 50px rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transform: scale(0.9);
    transition: transform 0.3s ease-in-out;
    max-height: 80vh;
    overflow-y: auto;
}

#settings-modal.show .settings-content {
    transform: scale(1);
}

.settings-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.settings-section h3 {
    color: #ffffff;
    font-size: 18px;
    margin-bottom: 15px;
    text-align: center;
    letter-spacing: 1px;
}

.volume-control {
    margin-bottom: 20px;
}

.volume-label {
    display: block;
    font-size: 14px;
    color: #cccccc;
    margin-bottom: 8px;
    text-align: left;
}

.volume-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.volume-slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(90deg, #333333, #666666);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(145deg, #ffffff, #cccccc);
    cursor: pointer;
    border: 2px solid #333333;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.volume-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(145deg, #ffffff, #cccccc);
    cursor: pointer;
    border: 2px solid #333333;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.volume-value {
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    min-width: 40px;
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.setting-item {
    margin-bottom: 15px;
}

.setting-label {
    color: #aaaaaa;
    font-size: 14px;
    text-align: center;
    font-style: italic;
}

.delete-save-button {
    background: linear-gradient(135deg, #ff4757, #ff3742);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 10px auto;
    display: block;
    box-shadow: 0 4px 15px rgba(255, 71, 87, 0.3);
}

.delete-save-button:hover {
    background: linear-gradient(135deg, #ff3742, #ff2f3a);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 71, 87, 0.4);
}

.delete-save-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(255, 71, 87, 0.3);
}

.setting-description {
    color: #888;
    font-size: 12px;
    text-align: center;
    margin: 5px 0 0 0;
    font-style: italic;
}