@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700&family=Noto+Serif+SC:wght@400;700&display=swap');

:root {
    --bg-color: #050505;
    --ui-gold: #cfaa68;
    --ui-red: #8a0e0e;
    --text-grey: #a0a0a0;
    --panel-bg: rgba(15, 15, 15, 0.98);
}

body {
    background-color: var(--bg-color);
    color: var(--text-grey);
    font-family: 'Cinzel', 'Noto Serif SC', serif;
    margin: 0;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    height: 100dvh; /* 移动端动态高度 */
    user-select: none;
    -webkit-user-select: none;
    touch-action: none; 
}

#game-container {
    position: relative;
    width: 100%; height: 100%;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    overflow: hidden;
}

canvas { z-index: 1; -webkit-touch-callout: none; }

/* 通用遮罩 */
.overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    background: rgba(0, 0, 0, 0.92);
    z-index: 10; transition: opacity 0.3s;
    padding: 20px; box-sizing: border-box;
}

/* 核心修复：隐藏时彻底屏蔽点击，防止幽灵按钮 */
.hidden { 
    opacity: 0; 
    pointer-events: none; 
    z-index: -1 !important;
}
.hidden button, .hidden input {
    pointer-events: none !important;
    visibility: hidden;
}
.overlay:not(.hidden) button, .overlay:not(.hidden) input {
    visibility: visible;
}

h1 {
    font-size: 1.8rem; color: var(--ui-gold);
    text-shadow: 0 0 10px rgba(207, 170, 104, 0.3);
    margin-bottom: 5px; text-align: center; letter-spacing: 2px;
}
.subtitle { font-size: 0.8rem; color: #666; margin-bottom: 30px; font-style: italic; }

/* 输入框 */
.input-group { width: 80%; max-width: 300px; margin-bottom: 20px; text-align: center; position: relative; z-index: 20; }

.soul-input {
    background: transparent; border: none; border-bottom: 2px solid #555;
    color: var(--ui-gold); font-family: 'Noto Serif SC', serif;
    font-size: 1.2rem; padding: 10px; width: 100%; text-align: center;
    outline: none; transition: border-color 0.3s; border-radius: 0;
    
    /* 修复输入框点击 */
    user-select: text !important;
    -webkit-user-select: text !important;
    pointer-events: auto !important;
    touch-action: manipulation !important;
}
.soul-input:focus { border-bottom-color: var(--ui-gold); }

/* 按钮 */
button {
    background: transparent; border: 1px solid var(--ui-gold);
    color: var(--ui-gold); padding: 15px 30px;
    font-family: 'Cinzel', serif; font-size: 1rem;
    cursor: pointer; text-transform: uppercase; letter-spacing: 1px;
    margin-top: 10px; -webkit-tap-highlight-color: transparent;
    transition: all 0.2s;
    pointer-events: auto !important; 
    touch-action: manipulation;
}
button:active { background: rgba(207, 170, 104, 0.2); transform: scale(0.98); }
button:disabled { border-color: #444; color: #444; pointer-events: none; }

.btn-group { display: flex; gap: 15px; margin-top: 20px; }
.hud-btn {
    margin: 0; padding: 6px 12px; font-size: 0.8rem; 
    background: rgba(0,0,0,0.6); border: 1px solid #444; 
    color: var(--ui-gold);
}

/* 结果页 */
#result-text {
    font-size: 3rem; font-weight: bold; text-transform: uppercase;
    letter-spacing: 2px; margin-bottom: 5px; opacity: 0;
    transform: scale(1.3); transition: all 0.5s; text-align: center;
}
#result-detail { font-size: 1.2rem; color: #ccc; margin-bottom: 5px; text-align: center; }
.show-result { opacity: 1 !important; transform: scale(1) !important; }
.spilled { color: var(--ui-red); text-shadow: 0 0 15px rgba(138, 14, 14, 0.8); }
.success { color: var(--ui-gold); text-shadow: 0 0 15px rgba(207, 170, 104, 0.8); }

/* --- 二维码样式 --- */
.qr-container {
    margin: 10px 0;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fadeIn 1s ease-in;
}

.qr-code {
    width: 110px; height: 110px;
    background-color: #fff; padding: 5px;
    border: 2px solid var(--ui-gold);
    box-shadow: 0 0 15px rgba(207, 170, 104, 0.2);
    border-radius: 4px;
}

.qr-hint {
    margin-top: 8px; font-size: 0.8rem; color: #888;
    line-height: 1.4; letter-spacing: 1px;
    text-transform: uppercase; font-weight: bold;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 小屏适配 */
@media (max-height: 650px) {
    .qr-code { width: 90px; height: 90px; }
    #result-text { font-size: 2rem; }
    .btn-group { margin-top: 10px; }
    button { padding: 10px 20px; }
}

/* 面板通用 */
.panel-common {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 90%; max-width: 400px; height: 75%;
    background: var(--panel-bg); border: 1px solid var(--ui-gold);
    z-index: 50; display: flex; flex-direction: column;
    box-shadow: 0 0 50px rgba(0,0,0,1);
}

.lb-header {
    background: rgba(207, 170, 104, 0.1); color: var(--ui-gold);
    padding: 15px; font-weight: bold; border-bottom: 1px solid #333;
    display: flex; justify-content: space-between; align-items: center;
}
.lb-close { cursor: pointer; padding: 0 10px; font-size: 1.5rem; }

/* 排行榜 Tabs */
.lb-tabs { display: flex; border-bottom: 1px solid #333; background: rgba(0,0,0,0.3); }
.lb-tab {
    flex: 1; text-align: center; padding: 10px; font-size: 0.8rem;
    color: #666; cursor: pointer; transition: all 0.2s; border-bottom: 2px solid transparent;
}
.lb-tab.active { color: var(--ui-gold); background: rgba(207, 170, 104, 0.05); border-bottom: 2px solid var(--ui-gold); }

.lb-list { flex: 1; overflow-y: auto; padding: 10px; font-size: 0.9rem; -webkit-overflow-scrolling: touch; }
.lb-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 5px; border-bottom: 1px solid #222;
}
.lb-item:nth-child(1) { color: #ffd700; }
.lb-item:nth-child(2) { color: #c0c0c0; }
.lb-item:nth-child(3) { color: #cd7f32; }
.lb-name { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding-right: 10px; text-align: left; }
.lb-score { color: var(--ui-gold); font-weight: bold; }
.lb-date { font-size: 0.7rem; color: #555; margin-left: 10px; }

/* 成就内容 */
.ach-content { flex: 1; overflow-y: auto; padding: 15px; -webkit-overflow-scrolling: touch; }
.stats-box { font-size: 0.9rem; color: #ccc; text-align: center; line-height: 1.6; }
.ach-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px; margin-bottom: 8px;
    background: rgba(255,255,255,0.03); border: 1px solid #333;
    opacity: 0.5; filter: grayscale(1); transition: all 0.3s;
}
.ach-item.unlocked {
    opacity: 1; filter: grayscale(0);
    border-color: var(--ui-gold);
    background: linear-gradient(90deg, rgba(207,170,104,0.1), transparent);
}
.ach-img { font-size: 1.5rem; width: 40px; text-align: center; }
.ach-detail { flex: 1; }
.ach-h { color: var(--ui-gold); font-size: 0.9rem; margin-bottom: 2px; }
.ach-d { color: #666; font-size: 0.7rem; }

/* 弹窗 */
#ach-toast {
    position: fixed; bottom: -100px; left: 50%; transform: translateX(-50%);
    background: #111; border: 1px solid var(--ui-gold);
    padding: 10px 20px; display: flex; align-items: center; gap: 15px;
    z-index: 100; transition: bottom 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    width: 80%; max-width: 300px; box-shadow: 0 10px 30px #000;
}
#ach-toast.show { bottom: 30px; }
.ach-info .ach-title { color: #666; font-size: 0.7rem; text-transform: uppercase; }
.ach-info .ach-name { color: var(--ui-gold); font-size: 0.9rem; font-weight: bold; }

/* HUD & Hints */
#hud { position: absolute; top: 40px; left: 20px; z-index: 5; font-size: 1rem; color: var(--ui-gold); }
#controls-hint {
    position: absolute; bottom: 8%; width: 100%; text-align: center;
    color: #555; font-size: 0.9rem; pointer-events: none;
    text-transform: uppercase; letter-spacing: 2px;
    animation: pulse 2s infinite;
}
@keyframes pulse { 0% { opacity: 0.5; } 50% { opacity: 1; } 100% { opacity: 0.5; } }
/* --- style.css 追加内容 --- */

/* 活动 Banner 容器 */
.lb-banner {
    background: linear-gradient(90deg, rgba(207, 170, 104, 0.1), rgba(0, 0, 0, 0.6));
    border-bottom: 1px solid #333;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

/* 左侧文字区域 */
.lb-banner-text {
    flex: 1;
    text-align: left;
    font-size: 0.8rem;
    line-height: 1.3;
}

/* 右侧二维码 */
.lb-banner-qr {
    width: 70px;
    height: 70px;
    background-color: #fff; /* 必须白底 */
    padding: 3px;
    border: 1px solid var(--ui-gold);
    border-radius: 4px;
    flex-shrink: 0; /* 防止被挤压 */
}

/* 针对小屏手机微调 */
@media (max-height: 600px) {
    .lb-banner { padding: 8px 10px; }
    .lb-banner-qr { width: 55px; height: 55px; }
    .lb-banner-text { font-size: 0.75rem; }
}
