/* ================= 字体注册 ================= */
@font-face {
    font-family: 'GameFont'; 
    src: url('../assets/fonts/Uranus_Pixel_11Px.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap; 
}

/* ================= 基础重置 ================= */
body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    background-color: #2c3e50;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'GameFont', 'Arial', sans-serif;
    user-select: none;
}

button, input { 
    font-family: inherit; 
}

/* ================= 游戏总容器 ================= */
#game-container {
    width: 320px;
    height: 568px;
    background-color: #34495e;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border-radius: 8px; 
    transform-origin: center center;
    transition: transform 0.3s ease;
}

/* ================= 屏幕切换逻辑 ================= */
.screen {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.hidden { 
    display: none !important;
    opacity: 0;
}

.active { 
    display: flex;
    opacity: 1;
}

/* ================= 标题与排版 ================= */
.game-title {
    color: #ffffff; 
    text-align: center;
    font-size: 50px;
    line-height: 1.1; 
    text-shadow:
        -1px -1px 0 #000000,
         1px -1px 0 #000000,
        -1px  1px 0 #000000,
         1px  1px 0 #000000,
         0    2px 0 #000000,
         0    3px 0 #000000,
         0    4px 8px rgba(0, 0, 0, 0.6);
    margin-bottom: 50px;
    image-rendering: pixelated;
}

h2 { 
    color: white;
    margin-bottom: 20px;
    text-shadow: 1px 1px 0 #000;
}

/* ================= 通用组件 ================= */
.btn {
    width: 200px; 
    padding: 15px 12px;
    margin: 8px 0;
    font-size: 18px; 
    font-weight: bold; 
    cursor: pointer;
    color: #2c3e50; 
    background-color: transparent; 
    background-image: url('../assets/images/框3.png'); 
    background-size: 100% 100%; 
    background-repeat: no-repeat;
    background-position: center;
    image-rendering: pixelated; 
    border: none; 
    box-shadow: none; 
    transition: transform 0.1s;
}

.btn:active { 
    transform: scale(0.95);
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background-color: rgba(255, 255, 255, 0.2);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.btn-icon:active { 
    background-color: rgba(255, 255, 255, 0.4);
}

/* ================= 布局容器 ================= */
.main-menu-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.menu-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px; 
}

/* ================= 弹窗模块 ================= */
.modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-container {
    width: 280px;
    position: relative;
}

.modal-content {
    width: 100%;
    min-height: 430px;
    height: auto; 
    padding: 55px 20px 75px 20px; 
    box-sizing: border-box;
    text-align: center;
    background-color: transparent;
    background-image: url('../assets/images/框4.png');
    background-size: 100% 100%;
    image-rendering: pixelated;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.btn-close-board {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 40px;
    height: 40px;
    background-image: url('../assets/images/叉.png');
    background-size: 100% 100%;
    background-color: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    z-index: 10; 
    transition: transform 0.1s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.btn-close-board:active { 
    transform: scale(0.9);
}

.modal-content h2 { 
    color: #2c3e50;
    text-shadow: none;
    margin-top: 5px;
    margin-bottom: 10px;
}

.modal-content p { 
    color: #34495e;
    font-size: 14px;
    margin-bottom: 15px;
}

#input-nickname, #input-password {
    width: 90%;
    padding: 10px;
    margin-bottom: 10px;
    border: 2px solid #bdc3c7;
    border-radius: 4px;
    font-size: 16px;
    text-align: center;
}

.modal-buttons { 
    display: flex;
    justify-content: space-between;
    width: 100%;
    gap: 10px;
}

.modal-buttons .btn {
    width: 45%; 
    margin: 0;
    background-image: url('../assets/images/框5.png'); 
}

/* ================= 设置列表 ================= */
.settings-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
    max-height: 290px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    box-sizing: border-box;
}

.settings-list::-webkit-scrollbar {
    width: 6px;
}

.settings-list::-webkit-scrollbar-track {
    background: rgba(44, 62, 80, 0.15);
    border-radius: 3px;
}

.settings-list::-webkit-scrollbar-thumb {
    background: #d35400;
    border-radius: 3px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    height: 46px; 
    padding: 0 12px;
    box-sizing: border-box;
    background-image: url('../assets/images/框6.png');
    background-size: 100% 100%;
    background-color: transparent;
    image-rendering: pixelated;
    flex-shrink: 0; 
}

.setting-item span { 
    color: #2c3e50;
    font-size: 16px;
    font-weight: bold;
}

.btn-toggle {
    width: 80px;
    height: 35px;
    background-color: transparent;
    background-image: url('../assets/images/框5.png');
    background-size: 100% 100%;
    image-rendering: pixelated;
    border: none;
    color: #d35400; 
    font-weight: bold;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: transform 0.1s;
}

.btn-toggle:active { 
    transform: scale(0.95);
}

.btn-toggle.muted { 
    filter: grayscale(100%);
    color: #333;
}

/* ================= 轮播选人 UI ================= */
.carousel-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    width: 100%;
    margin: 30px 0 20px 0;
}

.nav-arrow {
    background: none;
    border: none;
    color: #f1c40f;
    font-size: 36px;
    cursor: pointer;
    transition: transform 0.2s;
    text-shadow: 2px 2px 0 #000;
    z-index: 10;
}

.nav-arrow:active { 
    transform: scale(0.8);
}

.char-showcase {
    position: relative;
    width: 180px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.char-box {
    position: absolute;
    border-radius: 8px; 
    transition: transform 0.3s ease, opacity 0.3s ease, filter 0.3s ease, width 0.3s ease, height 0.3s ease, background-color 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    width: 60px;
    height: 60px;
    opacity: 0;
    transform: translateX(0) scale(0.5);
    z-index: 0;
    pointer-events: none;
}

.char-box.active {
    width: 90px;
    height: 90px;
    z-index: 3;
    opacity: 1;
    transform: translateX(0) scale(1);
    background-color: rgba(241, 196, 15, 0.2);
    border: 2px solid #f1c40f;
    box-shadow: 0 0 15px rgba(241, 196, 15, 0.6);
    filter: none;
}

.char-box.prev {
    width: 60px;
    height: 60px;
    z-index: 1;
    opacity: 0.5;
    transform: translateX(-65px) scale(1);
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid #7f8c8d;
    filter: grayscale(80%) brightness(0.6);
}

.char-box.next {
    width: 60px;
    height: 60px;
    z-index: 1;
    opacity: 0.5;
    transform: translateX(65px) scale(1);
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid #7f8c8d;
    filter: grayscale(80%) brightness(0.6);
}

.char-name-display { 
    color: #f1c40f;
    font-size: 22px;
    font-weight: bold;
    text-shadow: 1px 1px 0 #000;
}

.bottom-actions { 
    display: flex;
    gap: 10px;
    width: 260px;
    margin-top: 20px;
}

.bottom-actions .btn { 
    width: 50%;
}

/* ================= 专属排行榜 UI ================= */
.leaderboard-container {
    width: 300px;
    height: 480px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.leaderboard-board {
    width: 100%;
    height: 100%;
    background-image: url('../assets/images/排行榜.png');
    background-size: 100% 100%;
    image-rendering: pixelated;
    display: flex;
    flex-direction: column;
    align-items: center; 
    padding: 70px 18px 25px 18px; 
    box-sizing: border-box;
    background-color: transparent;
}

.board-title-banner {
    position: absolute;
    top: 6px;
    left: 0;
    width: 100%;
    margin-left: 20px;
    margin-top: -10px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: none;
    box-shadow: none;
    height: 40px;
    pointer-events: none;
    margin: 0;
}

.board-title-banner span {
    color: #e74c3c; 
    font-size: 22px;
    font-weight: bold;
    text-shadow: 1px 1px 0 #fff, -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 2px 2px 0 #fff;
    margin-left: 20px;
}

.board-tabs {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-bottom: 12px;
    flex-shrink: 0;
    width: 100%;
}

.board-tabs .tab {
    flex: 1;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-image: url('../assets/images/框5.png');
    background-size: 100% 100%;
    image-rendering: pixelated;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    filter: grayscale(100%) opacity(0.7);
    color: #2c3e50;
    transition: all 0.2s;
}

.board-tabs .tab.active { 
    filter: none;
    color: #d35400;
    text-shadow: 1px 1px 0 #fff;
}

.board-list {
    width: 100%;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 5px; 
}

.rank-item {
    display: flex;
    align-items: center;
    background-image: url('../assets/images/框6.png');
    background-size: 100% 100%;
    image-rendering: pixelated;
    padding: 8px 10px;
    min-height: 45px;
    color: #2c3e50;
    flex-shrink: 0;
}

.rank-num { 
    width: 25px;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    color: #7f8c8d;
}

.rank-num.top1 { 
    color: #f1c40f;
    font-size: 20px;
    text-shadow: 1px 1px 0 #d35400;
}

.rank-num.top2 { 
    color: #95a5a6;
    font-size: 18px;
    text-shadow: 1px 1px 0 #7f8c8d;
}

.rank-num.top3 { 
    color: #d35400;
    font-size: 18px;
    text-shadow: 1px 1px 0 #e67e22;
}

.rank-info { 
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-left: 8px;
    overflow: hidden;
}

.rank-name { 
    font-size: 14px;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rank-sub { 
    font-size: 10px;
    color: #7f8c8d;
    margin-top: 2px;
}

.rank-avatar { 
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    margin: 0 10px;
}

.rank-score {
    background-image: url('../assets/images/框5.png');
    background-size: 100% 100%;
    image-rendering: pixelated;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 10px;
    height: 30px;
    font-size: 14px;
    font-weight: bold;
    color: #d35400;
    min-width: 45px;
}

#gameCanvas {
    background-color: #70c5ce; 
}

/* ================= 音量滑块样式 ================= */
.volume-slider {
    width: 110px;
    height: 6px;
    -webkit-appearance: none;
    background: #bdc3c7;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    image-rendering: pixelated;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #d35400;
    border-radius: 2px;
    cursor: pointer;
    box-shadow: 1px 1px 0 #fff;
}

.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #d35400;
    border-radius: 2px;
    cursor: pointer;
    border: none;
    box-shadow: 1px 1px 0 #fff;
}

/* ================= 结算界面及遮罩优化 UI ================= */
.gameover-overlay {
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 100;
}

.gameover-title {
    color: #e74c3c;
    font-size: 42px;
    margin-top: 10px;
    margin-bottom: 12px;
    text-shadow: 2px 2px 0px #fff, -1px -1px 0px #fff, 1px -1px 0px #fff, -1px 1px 0px #fff;
}

.gameover-score-wrap {
    font-size: 16px;
    color: #34495e;
    margin-bottom: 12px;
    font-weight: bold;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.gameover-score-value {
    color: #d35400;
    font-size: 48px;
    text-shadow: 2px 2px 0px #f1c40f;
}

.gameover-btn-group {
    flex-direction: column;
    gap: 8px;
    width: 85%;
}

.gameover-btn-revive {
    width: 100%;
    margin: 0;
    color: #e74c3c;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 0;
    line-height: 1.1;
}

.gameover-btn-revive span:first-child {
    font-size: 14px;
    font-weight: bold;
}

.gameover-btn-revive span:last-child {
    font-size: 10px;
    color: #7f8c8d;
    margin-top: 2px;
}

.gameover-btn-standard {
    width: 100%;
    margin: 0;
    padding: 10px 0;
    font-size: 16px;
}

.gameover-btn-share {
    color: #d35400;
}

.gameover-btn-home {
    filter: grayscale(50%);
}

/* ================= 微信与浏览器引导 UI ================= */
.guide-overlay {
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    flex-direction: column;
    box-sizing: border-box;
    padding: 30px 20px;
}

.guide-wechat-wrap {
    justify-content: flex-start;
    align-items: flex-end;
}

.guide-browser-wrap {
    justify-content: center;
    align-items: center;
    text-align: center;
}

@keyframes bounceTopRight { 
    0%, 100% { transform: translate(0, 0); } 
    50% { transform: translate(15px, -15px); } 
}

.guide-arrow {
    color: #f1c40f;
    font-size: 60px;
    margin-right: 10px;
    text-shadow: 2px 2px 0 #000;
    animation: bounceTopRight 1s infinite;
}

.guide-text {
    color: white;
    font-size: 20px;
    text-align: right;
    margin-top: 20px;
    line-height: 1.8;
    text-shadow: 1px 1px 0 #000;
    font-weight: bold;
}

.guide-text-browser {
    font-size: 18px;
    text-align: center;
}

.guide-highlight-box {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 10px;
    border-radius: 6px;
}

.guide-highlight-green { color: #2ecc71; }
.guide-highlight-yellow { color: #f1c40f; }
.guide-highlight-large { font-size: 24px; display: inline-block; margin-top: 15px; }

.guide-browser-icon {
    color: #2ecc71;
    font-size: 60px;
    margin-bottom: 10px;
    text-shadow: 2px 2px 0 #000;
}

.guide-btn-group {
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 80%;
}

.guide-btn-action { color: #27ae60; }
.guide-btn-cancel { filter: grayscale(100%); }