:root {
    --bg-base: #0f172a;
    --bg-accent: #312e81;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --neon-cyan: #22d3ee;
    --neon-rose: #f43f5e;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; -webkit-tap-highlight-color: transparent; }

body {
    background: var(--bg-base);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    position: relative;
}

/* 高级感：动态渐变光晕背景 */
.bg-mesh {
    position: absolute; inset: 0; z-index: -1;
    background: radial-gradient(circle at 15% 50%, rgba(49, 46, 129, 0.4), transparent 50%),
                radial-gradient(circle at 85% 30%, rgba(15, 118, 110, 0.3), transparent 50%);
    filter: blur(60px);
}

body.flash-error .bg-mesh {
    animation: flash 0.2s ease-out;
}
@keyframes flash {
    0%, 100% { background-color: transparent; }
    50% { background-color: rgba(244, 63, 94, 0.3); } /* 报错时全屏泛红光 */
}

header {
    width: 100%; max-width: 500px;
    display: flex; justify-content: space-between;
    padding: 20px 25px;
    font-size: 1.2rem; font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.hud-item {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 8px 16px; border-radius: 20px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.highlight { color: var(--neon-cyan); font-weight: 700; }

#game-board {
    width: 90vw; height: 90vw;
    max-width: 500px; max-height: 500px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    display: grid; gap: 6px; padding: 12px;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255,255,255,0.1);
    container-type: inline-size; 
}

.cell {
    background: linear-gradient(145deg, rgba(255,255,255,0.05), rgba(255,255,255,0.01));
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    display: flex; justify-content: center; align-items: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    /* 修复文字撑破网格的隐患，强制行高 */
    line-height: 1; overflow: hidden; 
}

.cell:active { 
    transform: scale(0.92); 
    background: rgba(255,255,255,0.1);
    box-shadow: 0 0 15px var(--neon-cyan);
    border-color: var(--neon-cyan);
}
.cell:focus-visible { outline: 2px solid var(--neon-cyan); outline-offset: -2px; }

#overlay {
    position: fixed; inset: 0; z-index: 10;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    display: flex; justify-content: center; align-items: center;
}
#overlay.hidden { display: none; }

.glass-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 40px; border-radius: 24px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    transform: translateY(0);
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

h1 { font-weight: 700; font-size: 3.5rem; margin-bottom: 10px; background: linear-gradient(to right, #22d3ee, #818cf8); -webkit-background-clip: text; color: transparent; letter-spacing: 4px;}
p { font-weight: 400; color: var(--text-muted); margin-bottom: 30px; font-size: 1.1rem;}

button {
    background: linear-gradient(135deg, #06b6d4, #3b82f6);
    color: #fff; border: none;
    padding: 14px 36px; font-size: 1.2rem; border-radius: 30px;
    cursor: pointer; font-weight: 600; 
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}
button:active { transform: scale(0.95); box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3); }

/* ... 保留之前的 :root 和 body 等基础设定 ... */
:root {
    --bg-base: #0f172a;
    --bg-accent: #312e81;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --neon-cyan: #22d3ee;
    --neon-rose: #f43f5e;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; -webkit-tap-highlight-color: transparent; }

body { background: var(--bg-base); color: var(--text-main); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; display: flex; flex-direction: column; align-items: center; min-height: 100vh; overflow: hidden; position: relative; }

.bg-mesh { position: absolute; inset: 0; z-index: -1; background: radial-gradient(circle at 15% 50%, rgba(49, 46, 129, 0.4), transparent 50%), radial-gradient(circle at 85% 30%, rgba(15, 118, 110, 0.3), transparent 50%); filter: blur(60px); }

body.flash-error .bg-mesh { animation: flash 0.2s ease-out; }
@keyframes flash { 0%, 100% { background-color: transparent; } 50% { background-color: rgba(244, 63, 94, 0.3); } }

/* 👱‍♀️ 美化 HUD：加入等宽字体防止数字跳变引发的布局抖动，增强霓虹辉光 */
header {
    width: 100%; max-width: 500px;
    display: flex; justify-content: space-between;
    padding: 20px 25px;
    font-size: 1.1rem; font-weight: 500;
    letter-spacing: 2px; text-transform: uppercase;
}

.hud-item {
    background: var(--glass-bg); border: 1px solid var(--glass-border);
    padding: 8px 18px; border-radius: 30px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.1);
    display: flex; align-items: center; gap: 8px;
}

.highlight { 
    color: var(--neon-cyan); 
    font-weight: 700; 
    font-size: 1.3rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-variant-numeric: tabular-nums; /* 核心：开启等宽数字排版 */
    text-shadow: 0 0 10px rgba(34, 211, 238, 0.5); /* 霓虹辉光 */
}

#game-board { width: 90vw; height: 90vw; max-width: 500px; max-height: 500px; background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 16px; display: grid; gap: 6px; padding: 12px; backdrop-filter: blur(12px); box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255,255,255,0.1); container-type: inline-size; }

.cell { position: relative; background: linear-gradient(145deg, rgba(255,255,255,0.05), rgba(255,255,255,0.01)); border: 1px solid var(--glass-border); border-radius: 10px; display: flex; justify-content: center; align-items: center; cursor: pointer; transition: var(--transition); box-shadow: 0 2px 8px rgba(0,0,0,0.2); line-height: 1; overflow: hidden; }
.cell:active { transform: scale(0.92); background: rgba(255,255,255,0.1); box-shadow: 0 0 15px var(--neon-cyan); border-color: var(--neon-cyan); }
.cell:focus-visible { outline: 2px solid var(--neon-cyan); outline-offset: -2px; }

#overlay { position: fixed; inset: 0; z-index: 10; background: rgba(15, 23, 42, 0.7); backdrop-filter: blur(8px); display: flex; justify-content: center; align-items: center; }
#overlay.hidden { display: none; }

.glass-panel { background: var(--glass-bg); border: 1px solid var(--glass-border); padding: 40px; border-radius: 24px; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,0.5); transform: translateY(0); animation: float 6s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

h1 { font-weight: 700; font-size: 3.5rem; margin-bottom: 10px; background: linear-gradient(to right, #22d3ee, #818cf8); -webkit-background-clip: text; color: transparent; letter-spacing: 4px;}
p { font-weight: 400; color: var(--text-muted); margin-bottom: 30px; font-size: 1.1rem;}

/* 👱‍♀️ 双按钮合理布局 */
.action-group { display: flex; gap: 15px; justify-content: center; margin-top: 10px; }
button { background: linear-gradient(135deg, #06b6d4, #3b82f6); color: #fff; border: none; padding: 12px 28px; font-size: 1.1rem; border-radius: 30px; cursor: pointer; font-weight: 600; transition: var(--transition); box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4); }
button:active { transform: scale(0.95); box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3); }

/* 炫耀按钮降级样式，防止喧宾夺主 */
.secondary-btn { background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border); box-shadow: none; color: var(--text-main); }

/* 微信分享黑客引导层 */
#share-guide { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.85); backdrop-filter: blur(4px); color: #fff; text-align: right; padding: 30px 40px; font-size: 1.3rem; line-height: 1.6; }
#share-guide.hidden { display: none; }
.share-arrow { font-size: 4rem; color: var(--neon-cyan); margin-bottom: 15px; display: inline-block; animation: bounce 1s infinite alternate; }
@keyframes bounce { from { transform: translate(0, 0); } to { transform: translate(-15px, 15px); } }