* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

html, body {
    width: 100%;
    min-height: 100%;
    font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
    background: #05060f;
    color: #fff;
}

body {
    overflow-x: hidden;
}

/* 弹窗 / 游戏运行时锁定页面滚动 */
html:has(.game-overlay.active),
html:has(.modal-overlay.active),
html:has(.captcha-overlay.active) {
    overflow: hidden;
}

#starCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* 星空氛围叠层 */
.star-overlay {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 50% 0%, rgba(90,120,255,0.16), transparent 55%),
        radial-gradient(circle at 88% 88%, rgba(180,90,255,0.12), transparent 50%);
}

/* ==================== 页面容器 ==================== */
.page {
    position: relative;
    z-index: 1;
    max-width: 1180px;
    margin: 0 auto;
    padding: 112px 24px 40px;
}

.section {
    margin-top: 68px;
    scroll-margin-top: 96px;
}

.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.section-title {
    font-size: 1.5rem;
    color: #fff;
    letter-spacing: 0.06em;
}

.section-title::before {
    content: '✦';
    color: #7cc4ff;
    font-size: 0.9rem;
    margin-right: 10px;
}

.section-sub {
    color: rgba(255,255,255,0.5);
    font-size: 0.85rem;
    margin-top: 6px;
}

.section-tip {
    color: rgba(255,255,255,0.45);
    font-size: 0.8rem;
    letter-spacing: 0.06em;
}

/* 区块渐入 */
.section.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.section.reveal.visible {
    opacity: 1;
    transform: none;
}

/* ==================== 骨架屏 / 加载态 ==================== */
/* 首屏渲染前的占位内容，避免出现空白等待 */
.skeleton-block {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.sk-line,
.sk-btn,
.sk-btn-lg {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.06) 25%,
        rgba(255, 255, 255, 0.15) 37%,
        rgba(255, 255, 255, 0.06) 63%
    );
    background-size: 400% 100%;
    animation: sk-shimmer 1.4s ease infinite;
}

.sk-line {
    display: block;
    height: 14px;
    border-radius: 8px;
}

.sk-sm { height: 12px; width: 30%; }
.sk-md { height: 16px; width: 42%; }
.sk-lg { height: 26px; width: 58%; }
.sk-full { height: 14px; width: 100%; }

.sk-btn {
    display: block;
    height: 40px;
    width: 140px;
    border-radius: 999px;
    margin-top: 8px;
}

.sk-btn-lg {
    display: block;
    height: 48px;
    width: 100%;
    border-radius: 14px;
    margin-top: 8px;
}

/* 组合选择器提升特异性，覆盖 .game-tile / .stat-item 自身的背景 */
.game-tile.skeleton-tile,
.stat-item.skeleton-stat {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.06) 25%,
        rgba(255, 255, 255, 0.15) 37%,
        rgba(255, 255, 255, 0.06) 63%
    );
    background-size: 400% 100%;
    animation: sk-shimmer 1.4s ease infinite;
    border-color: rgba(255, 255, 255, 0.08);
    pointer-events: none;
}

.game-tile.skeleton-tile {
    min-height: 210px;
    border-radius: 20px;
}

.game-tile.skeleton-tile::before {
    display: none;
}

.stat-item.skeleton-stat {
    min-height: 74px;
    border-radius: 16px;
}

@keyframes sk-shimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* 打卡面板数据同步中的轻量提示 */
.cp-sync {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-left: 8px;
    border-radius: 50%;
    border: 2px solid rgba(156, 201, 255, 0.35);
    border-top-color: #9cc9ff;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

@media (prefers-reduced-motion: reduce) {
    .sk-line,
    .sk-btn,
    .sk-btn-lg,
    .game-tile.skeleton-tile,
    .stat-item.skeleton-stat,
    .cp-sync {
        animation: none;
    }
}

.site-title {
    font-size: clamp(2.5rem, 8vw, 5rem);
    color: #fff;
    text-shadow: 0 0 20px rgba(255,255,255,0.5), 0 0 40px rgba(100,180,255,0.3);
    letter-spacing: 0.3em;
    margin-bottom: 10px;
    animation: titleGlow 3s ease-in-out infinite alternate;
    text-align: center;
}

.site-subtitle {
    font-size: clamp(0.9rem, 2.5vw, 1.3rem);
    color: rgba(255,255,255,0.7);
    letter-spacing: 0.2em;
    margin-bottom: 30px;
    text-align: center;
}

@keyframes titleGlow {
    from { text-shadow: 0 0 20px rgba(255,255,255,0.5), 0 0 40px rgba(100,180,255,0.3); }
    to { text-shadow: 0 0 30px rgba(255,255,255,0.8), 0 0 60px rgba(100,180,255,0.5), 0 0 80px rgba(100,180,255,0.3); }
}

/* ==================== 顶部导航 ==================== */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 90;
    padding: 14px 24px;
    transition: padding 0.3s, background 0.3s, border-color 0.3s;
    border-bottom: 1px solid transparent;
}

.site-header.scrolled {
    padding: 8px 24px;
    background: rgba(8,10,24,0.75);
    backdrop-filter: blur(16px);
    border-bottom-color: rgba(255,255,255,0.08);
}

.nav-inner {
    max-width: 1180px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.12em;
    flex-shrink: 0;
}

.brand-mark {
    color: #7cc4ff;
    text-shadow: 0 0 14px rgba(124,196,255,0.85);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    overflow-x: auto;
    scrollbar-width: none;
}

.nav-links::-webkit-scrollbar {
    display: none;
}

.nav-link {
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 0.88rem;
    padding: 8px 15px;
    border-radius: 999px;
    white-space: nowrap;
    transition: color 0.25s, background 0.25s, box-shadow 0.25s;
}

.nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.08);
}

.nav-link.active {
    color: #fff;
    background: rgba(124,196,255,0.16);
    box-shadow: inset 0 0 0 1px rgba(124,196,255,0.35);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.btn-top-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    box-shadow: 0 4px 18px rgba(102,126,234,0.35);
}

.btn-top {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    padding: 8px 18px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
}

.btn-top:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.05);
}

/* ==================== 首屏 ==================== */
.hero {
    text-align: center;
    padding-top: 16px;
}

.hero-badge {
    display: inline-block;
    font-size: 0.75rem;
    letter-spacing: 0.22em;
    color: #9cc9ff;
    background: rgba(124,196,255,0.1);
    border: 1px solid rgba(124,196,255,0.25);
    padding: 6px 16px;
    border-radius: 999px;
    margin-bottom: 22px;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 32px;
}

.stat-item {
    min-width: 128px;
    padding: 16px 22px;
    border-radius: 16px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.1;
}

.stat-value span {
    font-size: 0.78rem;
    font-weight: 400;
    color: rgba(255,255,255,0.5);
    margin-left: 3px;
}

.stat-label {
    font-size: 0.76rem;
    color: rgba(255,255,255,0.55);
    margin-top: 6px;
    letter-spacing: 0.08em;
}

.hero-actions {
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 30px;
}

.btn-hero {
    text-decoration: none;
    color: #fff;
    padding: 12px 28px;
    border-radius: 999px;
    font-size: 0.95rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 8px 30px rgba(102,126,234,0.3);
    transition: transform 0.3s, box-shadow 0.3s;
}

.btn-hero.ghost {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.18);
    box-shadow: none;
}

.btn-hero:hover {
    transform: translateY(-2px);
}

/* ==================== 打卡布局：当前游戏 + 打卡面板 ==================== */
.checkin-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    gap: 20px;
    align-items: stretch;
}

.featured-card {
    position: relative;
    overflow: hidden;
    border-radius: 22px;
    padding: 28px;
    background: rgba(18,20,40,0.72);
    border: 1px solid rgba(255,255,255,0.12);
    backdrop-filter: blur(16px);
}

.featured-glow {
    position: absolute;
    inset: 0;
    opacity: 0.16;
    pointer-events: none;
}

.featured-body {
    position: relative;
    z-index: 1;
}

.featured-label {
    font-size: 0.7rem;
    letter-spacing: 0.24em;
    color: #9cc9ff;
}

.featured-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 16px 0 14px;
}

.featured-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    font-size: 1.8rem;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    flex-shrink: 0;
}

.featured-name {
    font-size: 1.45rem;
    color: #fff;
}

.featured-tagline {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.55);
    margin-top: 5px;
}

.featured-desc {
    font-size: 0.92rem;
    line-height: 1.75;
    color: rgba(255,255,255,0.68);
    max-width: 620px;
}

.featured-tags {
    margin: 16px 0 22px;
}

.featured-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.tag {
    display: inline-block;
    font-size: 0.72rem;
    color: rgba(255,255,255,0.7);
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 4px 11px;
    border-radius: 999px;
    margin-right: 8px;
    margin-bottom: 8px;
}

/* 打卡面板 */
.checkin-panel {
    display: flex;
    flex-direction: column;
    border-radius: 22px;
    padding: 24px;
    background: rgba(18,20,40,0.72);
    border: 1px solid rgba(255,255,255,0.12);
    backdrop-filter: blur(16px);
}

.cp-label {
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    color: #9cc9ff;
}

.cp-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin: 16px 0 4px;
}

.cp-streak-num {
    font-size: 2.4rem;
    font-weight: 700;
    line-height: 1;
    color: #ffd166;
    text-shadow: 0 0 24px rgba(255,209,102,0.35);
}

.cp-streak-unit {
    font-size: 0.82rem;
    color: rgba(255,255,255,0.5);
    margin-left: 8px;
}

.cp-total {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.55);
}

.cp-total b {
    color: #fff;
}

.cp-week {
    display: flex;
    gap: 6px;
    margin: 20px 0;
}

.cp-day {
    flex: 1;
}

.cp-day-dot {
    width: 100%;
    max-width: 34px;
    aspect-ratio: 1;
    margin: 0 auto;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 0.76rem;
    color: rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.25s;
}

.cp-day.done .cp-day-dot {
    background: linear-gradient(135deg, #ffd166, #ff9f1c);
    border-color: transparent;
    color: #2a1f00;
    box-shadow: 0 4px 14px rgba(255,180,60,0.35);
}

.cp-day.today .cp-day-dot {
    border-color: rgba(124,196,255,0.7);
    box-shadow: 0 0 0 3px rgba(124,196,255,0.15);
}

.cp-hint {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.4);
    text-align: center;
    margin-top: 12px;
}

/* 打卡按钮 */
.btn-checkin,
.btn-checkin-lg {
    border: none;
    cursor: pointer;
    font-family: inherit;
    color: #241a00;
    background: linear-gradient(135deg, #f6c453, #f0a92e);
    border-radius: 999px;
    box-shadow: 0 6px 22px rgba(240,180,60,0.28);
    transition: transform 0.25s, filter 0.25s, background 0.25s;
}

.btn-checkin:hover:not(.done),
.btn-checkin-lg:hover:not(.done) {
    transform: translateY(-2px);
    filter: brightness(1.06);
}

.btn-checkin-lg {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
    margin-top: auto;
}

.btn-checkin.sm {
    padding: 10px 14px;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.btn-checkin.done,
.btn-checkin-lg.done {
    background: rgba(74,222,128,0.14);
    color: #4ade80;
    border: 1px solid rgba(74,222,128,0.35);
    box-shadow: none;
    cursor: default;
}

.btn-checkin:disabled,
.btn-checkin-lg:disabled {
    cursor: default;
}

.spin {
    display: inline-block;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== 游戏库网格 ==================== */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.game-tile {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    padding: 22px;
    background: rgba(18,20,40,0.7);
    border: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(14px);
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
}

.game-tile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent, #64b4ff);
    opacity: 0.85;
}

.game-tile:hover {
    transform: translateY(-6px);
    border-color: rgba(124,196,255,0.35);
    box-shadow: 0 18px 40px rgba(0,0,0,0.45);
}

.game-tile.locked {
    opacity: 0.6;
}

.game-tile.locked:hover {
    transform: none;
    border-color: rgba(255,255,255,0.1);
    box-shadow: none;
}

.gt-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.gt-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 1.45rem;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.gt-name {
    font-size: 1.05rem;
    color: #fff;
}

.gt-tagline {
    font-size: 0.76rem;
    color: rgba(255,255,255,0.5);
    margin-top: 4px;
}

.gt-desc {
    flex: 1;
    font-size: 0.84rem;
    line-height: 1.7;
    color: rgba(255,255,255,0.6);
}

.gt-tags {
    margin: 14px 0;
}

.gt-actions {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.btn-play {
    flex: 1;
    padding: 11px 16px;
    font-size: 0.88rem;
    font-family: inherit;
    color: #fff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    background: var(--accent-grad, linear-gradient(135deg, #667eea, #764ba2));
    transition: filter 0.25s, transform 0.25s;
}

.btn-play:hover {
    filter: brightness(1.12);
    transform: translateY(-1px);
}

.btn-locked {
    width: 100%;
    padding: 11px;
    text-align: center;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.45);
    background: rgba(255,255,255,0.05);
    border: 1px dashed rgba(255,255,255,0.18);
    border-radius: 12px;
}

.empty-state {
    padding: 40px;
    text-align: center;
    color: rgba(255,255,255,0.5);
    font-size: 0.9rem;
}

/* ==================== 轻提示 ==================== */
.toast-wrap {
    position: fixed;
    left: 50%;
    bottom: 40px;
    transform: translateX(-50%);
    z-index: 1200;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}

.toast {
    padding: 12px 24px;
    border-radius: 999px;
    font-size: 0.88rem;
    color: #fff;
    background: rgba(20,22,44,0.96);
    border: 1px solid rgba(124,196,255,0.3);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
    animation: toastIn 0.3s ease;
}

.toast.out {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.3s, transform 0.3s;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
}

/* ==================== 页脚 ==================== */
.site-footer {
    margin-top: 72px;
    padding: 26px 0 8px;
    text-align: center;
    font-size: 12px;
    color: rgba(255,255,255,0.4);
    border-top: 1px solid rgba(255,255,255,0.07);
}

.site-footer a {
    color: rgba(255,255,255,0.45);
    text-decoration: none;
    transition: color 0.25s;
}

.site-footer a:hover {
    color: #7cc4ff;
}

.btn-start {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: #fff;
    padding: 12px 40px;
    font-size: 1.1rem;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 0.1em;
}

.btn-start:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 25px rgba(102,126,234,0.5);
}

/* 弹窗通用 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: rgba(20,20,40,0.95);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 35px;
    width: 100%;
    max-width: 400px;
    color: #fff;
    position: relative;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-box h2 {
    text-align: center;
    margin-bottom: 25px;
    font-size: 1.6rem;
    color: #64b4ff;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-close:hover {
    color: #fff;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.8);
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    background: rgba(255,255,255,0.05);
    color: #fff;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

.form-group input:focus {
    border-color: #64b4ff;
}

.form-group input::placeholder {
    color: rgba(255,255,255,0.3);
}

.btn-submit {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: #fff;
    font-size: 1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 5px;
}

.btn-submit:hover {
    transform: scale(1.02);
    box-shadow: 0 5px 20px rgba(102,126,234,0.4);
}

.form-switch {
    text-align: center;
    margin-top: 15px;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.6);
}

.form-switch a {
    color: #64b4ff;
    cursor: pointer;
    text-decoration: none;
}

.form-switch a:hover {
    text-decoration: underline;
}

.error-msg {
    color: #ff6b6b;
    font-size: 0.85rem;
    margin-top: 5px;
    display: none;
}

.user-info {
    display: none;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-size: 0.9rem;
}

.user-info.active {
    display: flex;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
}

/* 排行榜 */
.lb-modal {
    max-width: 480px;
}

.lb-meta {
    text-align: center;
    color: rgba(255,255,255,0.55);
    font-size: 0.88rem;
    margin: -4px 0 12px;
}

.lb-meta b {
    color: #cfe3ff;
    font-weight: 700;
}

.lb-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
    justify-content: center;
}

.lb-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.7);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
}

.lb-chip:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.lb-chip.active {
    background: linear-gradient(135deg, rgba(102,126,234,0.85), rgba(118,75,162,0.85));
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 14px rgba(102,126,234,0.32);
}

.lb-chip-ico {
    font-size: 0.95rem;
    line-height: 1;
}

.lb-period {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-bottom: 14px;
    padding: 3px;
    background: rgba(255,255,255,0.04);
    border-radius: 8px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.lb-period button {
    border: 0;
    background: transparent;
    color: rgba(255,255,255,0.55);
    padding: 5px 14px;
    font-size: 0.78rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.18s ease;
}

.lb-period button:hover {
    color: #fff;
}

.lb-period button.active {
    background: rgba(255,255,255,0.12);
    color: #fff;
    font-weight: 600;
}

.leaderboard-list {
    max-height: 360px;
    overflow-y: auto;
    margin: 0 -6px;
    padding: 0 6px;
}

.leaderboard-list::-webkit-scrollbar {
    width: 5px;
}

.leaderboard-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 5px;
}

.lb-item {
    display: flex;
    align-items: center;
    padding: 11px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    transition: background 0.2s;
}

.lb-item:hover {
    background: rgba(255,255,255,0.05);
}

.lb-item.gold    { background: linear-gradient(90deg, rgba(255,215,0,0.08), transparent 70%); }
.lb-item.silver  { background: linear-gradient(90deg, rgba(192,192,192,0.08), transparent 70%); }
.lb-item.bronze  { background: linear-gradient(90deg, rgba(205,127,50,0.08), transparent 70%); }

.lb-rank {
    width: 36px;
    font-weight: bold;
    font-size: 1.05rem;
    text-align: center;
}

.lb-rank.gold { color: #ffd700; }
.lb-rank.silver { color: #c0c0c0; }
.lb-rank.bronze { color: #cd7f32; }

.lb-name {
    flex: 1;
    padding: 0 10px;
    font-size: 0.95rem;
    color: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.lb-name span.lb-tag {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 999px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    font-weight: 600;
}

.lb-score {
    font-weight: bold;
    color: #64b4ff;
    white-space: nowrap;
}

.lb-divider {
    text-align: center;
    color: rgba(255,255,255,0.25);
    padding: 8px 0;
    font-size: 0.78rem;
    letter-spacing: 4px;
}

.lb-item.lb-mine {
    background: rgba(102,126,234,0.18);
    border-radius: 8px;
    border-bottom-color: transparent;
    margin-top: 4px;
}

.lb-item.lb-mine .lb-rank { color: #cfe3ff; }
.lb-item.lb-mine .lb-score { color: #ffd700; }

.lb-empty {
    text-align: center;
    padding: 30px;
    color: rgba(255,255,255,0.4);
}

@media (max-width: 480px) {
    .lb-modal {
        max-width: 96vw;
        padding: 22px 18px;
    }
    .lb-chip {
        padding: 5px 10px;
        font-size: 0.76rem;
    }
    .lb-period button {
        padding: 4px 10px;
        font-size: 0.74rem;
    }
    .lb-name { font-size: 0.88rem; }
}

/* 游戏界面 */
.game-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 100;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.game-overlay.active {
    display: flex;
}

.countdown-warning {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 4rem;
    font-weight: bold;
    color: #ff4444;
    text-shadow: 0 0 20px rgba(255,68,68,0.8), 0 0 40px rgba(255,68,68,0.5);
    z-index: 102;
    display: none;
    animation: countdownPulse 0.8s ease-in-out infinite;
    pointer-events: none;
}

.countdown-warning.active {
    display: block;
}

@keyframes countdownPulse {
    0%, 100% { transform: translateX(-50%) scale(1); opacity: 1; }
    50% { transform: translateX(-50%) scale(1.3); opacity: 0.85; }
}

.game-header {
    position: absolute;
    top: 15px;
    left: 0;
    width: 100%;
    /* grid 2 列：左 1fr 自适应但被稳定；右 auto 永远在屏幕最右，
       不论左侧数字怎么变都不会抖动位移。z-index 让头部永久在画布之上，
       避免画布覆盖按钮导致 click 不触发。 */
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 16px;
    padding: 0 20px;
    color: #fff;
    font-size: 1.1rem;
    z-index: 50;
    pointer-events: none;   /* 容器不挡事件，子元素按需单独控制 */
}
/* 头部所有子元素默认接收事件；HUD 文字/数字本身不响应事件，透传给画布 */
.game-header > * { pointer-events: auto; }
.game-header .moon-hud { pointer-events: none; }
.game-header .game-header-right { pointer-events: auto; }

.game-stats {
    display: flex;
    align-items: center;
    gap: 18px;
    /* 空间不足时换行，不溢出到右侧按钮区 */
    flex-wrap: wrap;
    row-gap: 3px;
}

.game-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 右侧组合：累计存活时间 + 操作按钮，flex 横向排列 */
.game-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    /* 即使 .moon-hud 数字变化，本块宽度变化也不会让按钮位置抖动 */
    justify-content: flex-end;
}

/* 累计存活时间：右上角显示；固定最小宽度让 mm:ss → mmm:ss 不会撑动按钮 */
.moon-time {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 96px;
    padding: 4px 12px;
    border-radius: 18px;
    background: rgba(15,20,40,0.55);
    border: 1px solid rgba(150,185,255,0.28);
    color: rgba(220,235,255,0.92);
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    font-size: 0.92rem;
    letter-spacing: 0.03em;
    white-space: nowrap;
    box-shadow: 0 0 10px rgba(90,130,255,0.18);
    /* 即使从 00:00 变到 999:59（7 字符），min-width 已预留足够空间 */
}

/* 右上角三个按钮：明显更大、点击区域充足、视觉分层清晰 */
.btn-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 96px;
    min-height: 40px;
    padding: 9px 18px;
    background: rgba(40, 55, 90, 0.72);
    border: 1.5px solid rgba(160, 195, 255, 0.42);
    color: #fff;
    border-radius: 22px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    line-height: 1;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 2px 10px rgba(20, 30, 60, 0.45),
                inset 0 1px 0 rgba(255, 255, 255, 0.12);
    transition: background .15s ease, transform .12s ease,
                box-shadow .15s ease, border-color .15s ease;
    position: relative;
    z-index: 1;
}
.btn-close:hover {
    background: rgba(70, 95, 150, 0.85);
    border-color: rgba(190, 215, 255, 0.7);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(40, 60, 110, 0.55),
                inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn-close:active {
    transform: translateY(0);
    background: rgba(35, 50, 85, 0.95);
    box-shadow: 0 1px 4px rgba(20, 30, 60, 0.5),
                inset 0 1px 2px rgba(0, 0, 0, 0.2);
}
.btn-close:focus-visible {
    outline: 2px solid rgba(150, 200, 255, 0.85);
    outline-offset: 2px;
}

/* 三个按钮按角色配色（细微色差，提高辨识度，仍保持整体冷色调） */
.btn-close#moonHelpBtn    { border-color: rgba(120, 200, 255, 0.55); }
.btn-close#moonHelpBtn:hover    { background: rgba(55, 110, 175, 0.85); }
.btn-close#moonPauseBtn   { border-color: rgba(255, 220, 130, 0.55); }
.btn-close#moonPauseBtn:hover   { background: rgba(140, 110, 50, 0.85); }
.btn-close#moonExitBtn    { border-color: rgba(255, 140, 150, 0.55); }
.btn-close#moonExitBtn:hover    { background: rgba(170, 60, 80, 0.85); }

#gameCanvas {
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    max-width: 90vw;
    max-height: 65vh;
    touch-action: none;
}

.game-instruction {
    color: rgba(255,255,255,0.5);
    margin-top: 12px;
    font-size: 0.8rem;
}

.game-over-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(20,20,40,0.98);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 35px;
    text-align: center;
    color: #fff;
    display: none;
    z-index: 101;
    min-width: 280px;
}

.game-over-panel.active {
    display: block;
}

.game-over-panel h2 {
    font-size: 1.8rem;
    margin-bottom: 10px;
    color: #ffd700;
}

.game-over-panel .final-score {
    font-size: 1.3rem;
    margin-bottom: 8px;
}

.game-over-panel .high-score {
    font-size: 0.95rem;
    color: rgba(255,255,255,0.6);
    margin-bottom: 20px;
}

.game-over-icon {
    font-size: 3rem;
    margin-bottom: 5px;
    animation: gameOverFloat 1.5s ease-in-out infinite;
}

@keyframes gameOverFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.game-over-stats {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.6);
    margin-bottom: 15px;
}

.game-over-stats b {
    color: #ffd700;
}

.game-over-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.game-over-buttons .btn-restart,
.game-over-buttons .btn-leaderboard,
.game-over-buttons .btn-home,
.game-over-buttons .btn-revive {
    width: 100%;
    margin: 0;
    padding: 12px 20px;
    font-size: 1rem;
}

.btn-restart, .btn-leaderboard {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border: none;
    color: #fff;
    padding: 10px 28px;
    font-size: 0.95rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
    margin: 5px;
}

.btn-leaderboard {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.btn-restart:hover, .btn-leaderboard:hover {
    transform: scale(1.05);
}

.btn-home {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    padding: 10px 28px;
    font-size: 0.95rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
    margin: 5px;
}

.btn-home:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.05);
}

/* 游戏说明面板 */
.game-help-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(20,20,40,0.98);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 28px;
    color: #fff;
    display: none;
    z-index: 101;
    width: 90%;
    max-width: 380px;
    max-height: 85vh;
    overflow-y: auto;
    text-align: left;
}

.game-help-panel.active {
    display: block;
}

.game-help-panel h2 {
    text-align: center;
    font-size: 1.5rem;
    color: #64b4ff;
    margin-bottom: 16px;
}

.help-section {
    margin-bottom: 12px;
    padding: 10px 14px;
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
}

.help-section h3 {
    font-size: 0.95rem;
    color: #ffd700;
    margin-bottom: 6px;
}

.help-section p {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.75);
    line-height: 1.8;
}

.btn-help-confirm {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: #fff;
    font-size: 1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 6px;
}

.btn-help-confirm:hover {
    transform: scale(1.02);
    box-shadow: 0 5px 20px rgba(102,126,234,0.4);
}

.combo-text {
    position: absolute;
    color: #ffd700;
    font-size: 1.2rem;
    font-weight: bold;
    pointer-events: none;
    animation: comboFloat 1s ease-out forwards;
    text-shadow: 0 0 10px rgba(255,215,0,0.5);
}

@keyframes comboFloat {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-50px) scale(1.3); }
}

/* 人机验证 */
.captcha-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.captcha-box {
    background: rgba(20,20,40,0.95);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 40px;
    max-width: 360px;
    width: 90%;
    text-align: center;
}

.captcha-box h2 {
    color: #64b4ff;
    margin-bottom: 10px;
}

.captcha-hint {
    color: rgba(255,255,255,0.6);
    margin-bottom: 25px;
    font-size: 0.9rem;
}

.captcha-slider-track {
    width: 100%;
    height: 40px;
    background: rgba(255,255,255,0.1);
    border-radius: 20px;
    position: relative;
    overflow: hidden;
}

#sliderFill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 20px;
    transition: width 0.1s;
}

#sliderThumb {
    position: absolute;
    left: 0;
    top: 0;
    width: 40px;
    height: 40px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: transform 0.1s;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

/* 音乐播放器 */
#musicPanel {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 50;
    background: rgba(20,20,40,0.9);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 15px;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    backdrop-filter: blur(10px);
}

#musicToggle {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.3rem;
    cursor: pointer;
    transition: transform 0.3s;
}

#musicToggle.playing {
    animation: musicPulse 1.5s ease-in-out infinite;
}

@keyframes musicPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

#musicControls {
    display: none;
    align-items: center;
    gap: 10px;
}

#musicControls button {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 1rem;
}

#playBtn {
    font-size: 1.2rem;
    width: 30px;
}

#musicName {
    color: rgba(255,255,255,0.7);
    font-size: 0.85rem;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#volumeSlider {
    width: 60px;
    accent-color: #667eea;
}

/* ==================== 响应式 ==================== */
@media (max-width: 900px) {
    .checkin-layout {
        grid-template-columns: 1fr;
    }
    .checkin-panel .btn-checkin-lg {
        margin-top: 20px;
    }
}

@media (max-width: 720px) {
    .site-header {
        padding: 12px 16px;
    }
    .site-header.scrolled {
        padding: 8px 16px;
    }
    .nav-inner {
        flex-wrap: wrap;
        gap: 10px;
    }
    .nav-links {
        order: 3;
        width: 100%;
        margin-left: 0;
        justify-content: flex-start;
    }
    .nav-actions {
        margin-left: auto;
    }
    .page {
        padding: 152px 16px 32px;
    }
    .section {
        margin-top: 52px;
    }
    .section-head {
        align-items: flex-start;
    }
    .game-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
    #musicPanel {
        bottom: 14px;
        left: 14px;
        padding: 10px 14px;
    }
}

@media (max-width: 480px) {
    .game-header {
        font-size: 0.9rem;
        padding: 0 15px;
    }
    .modal-box {
        padding: 25px 20px;
    }
    .btn-top {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    .brand-name {
        font-size: 0.95rem;
    }
    .featured-card,
    .checkin-panel {
        padding: 20px;
    }
    .stat-item {
        min-width: 104px;
        padding: 13px 16px;
    }
    .stat-value {
        font-size: 1.35rem;
    }
    .game-grid {
        grid-template-columns: 1fr;
    }
    .toast-wrap {
        bottom: 24px;
        width: 90%;
    }
    .toast {
        font-size: 0.82rem;
        text-align: center;
    }
}

/* ==================== 月影迷航（第二款小游戏） ==================== */

/* 复用站点既有的 .game-* 浮层样式，仅补充本作专属部分 */
#moonOverlay {
    /* 画布显示宽度：桌面端上限 1100px，竖屏手机由 94vw / 96vh 约束，
       较旧的 860px 提升约 28%，充分利用宽屏显示空间。 */
    --moon-w: min(94vw, 1100px, 96vh);
    background: radial-gradient(circle at 50% 38%, rgba(22,26,64,0.97) 0%, rgba(3,4,12,0.99) 72%);
    /* 移动端禁止长按触发复制/选择菜单，以及避免文本被选中影响操作手感 */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

#moonOverlay .game-stats b {
    color: #cfe3ff;
}

/* 画布 + 画布内浮层（Boss 血条）的定位舞台 */
.moon-stage {
    position: relative;
    line-height: 0;
}

#moonCanvas {
    /* 逻辑分辨率 880×660（约 1.33:1），显示尺寸由这里决定：
       94vw / 860px / 96vh 三重上限保证桌面与竖屏手机都安全，
       height:auto 让浏览器按画布固有比例自动换算高度。 */
    width: var(--moon-w);
    height: auto;
    display: block;
    border: 2px solid rgba(150,185,255,0.28);
    border-radius: 12px;
    background: #05060f;
    box-shadow: 0 0 44px rgba(90,130,255,0.20);
    touch-action: none;
    cursor: pointer;
    /* 关闭按下屏幕时的视觉闪烁反馈：
       -webkit-tap-highlight-color：移除 iOS/Android 默认触摸高亮层
       -webkit-touch-callout：禁用 iOS 长按弹出菜单
       user-select：避免长按出现文本选择气泡
       -webkit-user-drag：防止图片/画布被拖拽
       同时显式重置 :active / :hover 状态以保证按住时画面无任何变化 */
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
    user-select: none;
    -webkit-user-select: none;
    outline: none;
}
#moonCanvas:hover,
#moonCanvas:active,
#moonCanvas:focus {
    /* 按住屏幕时禁止任何样式变化，确保仅保留长按的实际功能逻辑 */
    filter: none;
    transform: none;
    background: #05060f;
    box-shadow: 0 0 44px rgba(90,130,255,0.20);
    border-color: rgba(150,185,255,0.28);
    opacity: 1;
}

.moon-float {
    position: absolute;
    z-index: 5;
    color: #d7e9ff;
    font-size: 0.98rem;
    font-weight: 700;
    white-space: nowrap;
    pointer-events: none;
    text-shadow: 0 0 10px rgba(150,205,255,0.85), 0 0 22px rgba(90,140,255,0.55);
    animation: moonFloatUp 1s ease-out forwards;
}

@keyframes moonFloatUp {
    0%   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -230%) scale(1.22); }
}

/* ---------------- 本作专属 HUD：耐久 / 轮次 / Boss 血条 / 屏幕提示 ---------------- */

#moonOverlay .moon-hud {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
    /* 关键：不设 min-width，允许 HUD 收缩到列宽内，
       绝不侵入右侧按钮区（修复与按钮重叠遮挡问题） */
    min-width: 0;
    max-width: 100%;
}

#moonOverlay .moon-stats2 {
    align-items: center;
    gap: 14px;
    font-size: 0.92rem;
    /* 空间不足时换行而不是溢出压到按钮上 */
    flex-wrap: wrap;
    row-gap: 3px;
}

/* 头部所有数字：等宽 + 固定最小宽度，位数变化不会撑动布局 */
#moonOverlay .game-stats b,
#moonOverlay .moon-stats2 b,
#moonOverlay .moon-level b,
#moonOverlay .moon-time {
    display: inline-block;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

/* 各数字框固定最小宽度（ch 是 0 字宽；right 让位数变化时数字始终右对齐） */
#moonOverlay #moonScoreVal { min-width: 4ch; text-align: right; }
#moonOverlay #moonComboVal { min-width: 3ch; text-align: right; }
#moonOverlay #moonDistVal  { min-width: 5ch; text-align: right; }
#moonOverlay #moonHpVal    { min-width: 3.5ch; text-align: right; }

/* 标签 + 数字包裹：固定布局，不让文字与数字因字距不同而被拉变形 */
#moonOverlay .game-stats > span {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    white-space: nowrap;
    flex-shrink: 0;
}
#moonOverlay .moon-stats2 > .moon-hp-wrap {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
    flex-shrink: 0;
}

.moon-hp-wrap {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.moon-hp-label {
    color: rgba(255,255,255,0.6);
    font-size: 0.85em;
    letter-spacing: 0.05em;
}

.moon-hp-track {
    display: block;
    width: 104px;
    height: 10px;
    border-radius: 6px;
    background: rgba(255,255,255,0.13);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.10);
    overflow: hidden;
}

.moon-hp-track i {
    display: block;
    height: 100%;
    width: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg, #5ef0a0 0%, #7fc4ff 100%);
    box-shadow: 0 0 10px rgba(120,220,200,0.45);
    transition: width .18s ease, background .3s ease;
}

.moon-hp-track.low i {
    background: linear-gradient(90deg, #ffd166 0%, #ff9f43 100%);
    box-shadow: 0 0 10px rgba(255,180,80,0.45);
}

.moon-hp-track.crit i {
    background: linear-gradient(90deg, #ff6b6b 0%, #ff2d55 100%);
    box-shadow: 0 0 12px rgba(255,70,90,0.6);
}

.moon-level {
    padding: 2px 11px;
    border-radius: 11px;
    background: rgba(167,139,250,0.16);
    border: 1px solid rgba(167,139,250,0.40);
    color: #ddd0ff;
    font-size: 0.86em;
    white-space: nowrap;
    transition: background .3s ease, border-color .3s ease, color .3s ease;
}

.moon-level.soon {
    background: rgba(255,60,90,0.20);
    border-color: rgba(255,90,110,0.62);
    color: #ffd0d8;
    animation: moonLevelSoon 0.9s ease-in-out infinite;
}

@keyframes moonLevelSoon {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

/* Boss 血条：下移到画布上沿下方，避开玩家头顶 HUD，避免遮挡玩家 HP / 累计时间 */
.moon-bossbar {
    position: absolute;
    top: 70px;
    left: 50%;
    width: 64%;
    max-width: 520px;
    transform: translateX(-50%) translateY(-10px) scaleX(0.86);
    opacity: 0;
    pointer-events: none;
    z-index: 6;
    transition: opacity .3s ease, transform .45s cubic-bezier(.2,.9,.3,1.25);
}

.moon-bossbar.active {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scaleX(1);
}

.moon-bossbar-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 5px;
    padding: 0 2px;
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    color: #ffd9de;
    text-shadow: 0 0 10px rgba(255,80,90,0.6);
}

.moon-bossbar-name {
    font-weight: 700;
}

.moon-bossbar-track {
    height: 13px;
    border-radius: 8px;
    background: rgba(8,6,18,0.78);
    border: 1px solid rgba(255,120,140,0.45);
    box-shadow: 0 0 18px rgba(255,70,90,0.28), inset 0 0 10px rgba(0,0,0,0.5);
    overflow: hidden;
}

.moon-bossbar-track i {
    display: block;
    height: 100%;
    width: 100%;
    border-radius: 8px;
    background: linear-gradient(90deg, #ff5f6d 0%, #ffc371 100%);
    transition: width .16s linear;
}

.moon-bossbar.phase2 .moon-bossbar-track i {
    background: linear-gradient(90deg, #ff3d6e 0%, #ff9f43 100%);
}

.moon-bossbar.phase3 .moon-bossbar-track i {
    background: linear-gradient(90deg, #ff0044 0%, #ff6b00 100%);
    animation: moonBossEnrage 1s ease-in-out infinite;
}

@keyframes moonBossEnrage {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.35); }
}

/* 屏幕中上方横幅提示 */
.moon-warning {
    position: fixed;
    left: 50%;
    top: 24%;
    transform: translate(-50%, -50%) scale(0.92);
    opacity: 0;
    font-weight: 800;
    font-size: 1.7rem;
    letter-spacing: 0.05em;
    text-align: center;
    white-space: nowrap;
    pointer-events: none;
    z-index: 106;
    transition: opacity .18s ease, transform .18s ease;
}

.moon-warning.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    animation: moonWarnPulse 0.95s ease-in-out infinite;
}

.moon-warning-danger {
    color: #ff5f7a;
    text-shadow: 0 0 18px rgba(255,60,90,0.8), 0 0 44px rgba(255,60,90,0.45);
}

.moon-warning-warn {
    color: #ffd166;
    font-size: 1.28rem;
    text-shadow: 0 0 16px rgba(255,190,60,0.65);
}

.moon-warning-good {
    color: #8affc1;
    text-shadow: 0 0 18px rgba(90,255,170,0.6);
}

.moon-warning-level {
    color: #cbb4ff;
    text-shadow: 0 0 18px rgba(167,139,250,0.65);
}

@keyframes moonWarnPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* 受击红闪 */
.moon-hitflash {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 104;
    opacity: 0;
    background: radial-gradient(circle at 50% 50%, rgba(255,0,60,0) 40%, rgba(255,20,60,0.45) 100%);
}

.moon-hitflash.active {
    animation: moonHitFlash 0.44s ease-out;
}

@keyframes moonHitFlash {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* ============================================================
 * 月影迷航 · 死亡弹窗 / 免费复活 / 移动端布局
 * ============================================================ */

/* ---- 结束面板：覆盖默认的 display:none/block，改用透明+缩放过渡，让"弹窗"更有仪式感 ---- */
#moonOverlay .game-over-panel {
    display: block;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.86);
    transition: opacity .24s ease, transform .32s cubic-bezier(.2,.9,.3,1.25);
    pointer-events: none;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    box-shadow:
        0 20px 60px rgba(0,0,0,0.55),
        0 0 0 1px rgba(255,215,90,0.22),
        0 0 50px rgba(255,180,90,0.14);
}
#moonOverlay .game-over-panel.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}

/* 死亡图标：脉动 */
.moon-over-icon {
    animation: moonOverIconPulse 1.1s ease-in-out infinite;
    text-shadow: 0 0 18px rgba(255,80,100,0.7), 0 0 38px rgba(255,60,90,0.45);
}
@keyframes moonOverIconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.12); }
}
.moon-over-title {
    color: #ffcfcf;
    text-shadow: 0 0 14px rgba(255,90,110,0.5);
}

.moon-new-record {
    color: #ffd700;
    font-size: 0.9rem;
    margin-bottom: 10px;
    display: none;
}
.moon-revive-note {
    color: rgba(255,210,140,0.85);
    font-size: 0.82rem;
    margin: -4px 0 10px;
    display: none;
}

/* 免费复活按钮：金橙渐变 + 流光，作为主 CTA */
.game-over-buttons .btn-revive {
    background: linear-gradient(135deg, #ffd166 0%, #ff9f43 55%, #ff6b6b 100%);
    color: #2a1a06;
    font-weight: 800;
    letter-spacing: 0.04em;
    box-shadow:
        0 6px 22px rgba(255,170,60,0.5),
        0 0 0 1px rgba(255,210,120,0.55),
        inset 0 1px 0 rgba(255,255,255,0.4);
    position: relative;
    overflow: hidden;
    order: -1;        /* 始终排在第一位 */
}
.game-over-buttons .btn-revive::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.55), transparent);
    transform: translateX(-100%);
    animation: moonReviveShine 2.2s ease-in-out infinite;
    pointer-events: none;
}
.game-over-buttons .btn-revive:hover {
    transform: scale(1.04);
    box-shadow: 0 8px 28px rgba(255,170,60,0.65), 0 0 0 1px rgba(255,210,120,0.7);
}
@keyframes moonReviveShine {
    0%        { transform: translateX(-100%); }
    60%, 100% { transform: translateX(120%); }
}

/* 死亡中提示文字：避免"毫无反应"的体验 */
.moon-dying-text {
    position: fixed;
    left: 50%; top: 38%;
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0;
    font-size: 2.4rem;
    font-weight: 800;
    color: #ffb4b4;
    letter-spacing: 0.08em;
    text-shadow: 0 0 18px rgba(255,80,100,0.85), 0 0 40px rgba(255,60,90,0.5);
    pointer-events: none;
    z-index: 107;
    transition: opacity .18s ease, transform .18s ease;
}
.moon-dying-text.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    animation: moonDyingTextPulse 0.6s ease-in-out infinite;
}
@keyframes moonDyingTextPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.55; }
}

/* 复活倒计时：大号 3-2-1 */
.moon-revive-countdown {
    position: fixed;
    left: 50%; top: 38%;
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 0;
    font-size: 6rem;
    font-weight: 900;
    color: #ffe7a0;
    text-shadow: 0 0 30px rgba(255,210,120,0.85), 0 0 80px rgba(255,170,60,0.55);
    pointer-events: none;
    z-index: 108;
    transition: opacity .2s ease, transform .25s cubic-bezier(.3,1.4,.4,1);
}
.moon-revive-countdown.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    animation: moonReviveCountPulse 1s ease-in-out infinite;
}
@keyframes moonReviveCountPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50%      { transform: translate(-50%, -50%) scale(1.12); }
}

/* 浮层弹出时，底部的玩法说明让出位置 */
#moonOverlay:has(.game-over-panel.active) .game-instruction,
#moonOverlay:has(.game-help-panel.active) .game-instruction,
#moonOverlay:has(#moonPausePanel.active) .game-instruction {
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
}

/* ============================================================
 * 移动端布局（max-width: 720px）
 *   - 画布以 object-fit:contain 充满舞台，移动竖屏下游戏高度提升约 22%
 *   - 舞台自身作为游戏外框（border/shadow 移到舞台），避免 letterbox 时
 *     边框包住整个屏幕；画布透明，画布外的区域透出页面深色渐变
 * ============================================================ */
@media (max-width: 720px) {
    #moonOverlay {
        justify-content: flex-start;
        padding: 0;
    }
    #moonOverlay .game-header {
        padding: 5px 10px;
        font-size: 0.78rem;
        column-gap: 10px;
    }
    #moonOverlay .game-stats      { gap: 8px; }
    #moonOverlay .game-header-actions { gap: 5px; }
    /* 窄屏按钮：去掉 min-width（避免撑宽与 HUD 重叠），保持触控高度 */
    #moonOverlay .btn-close       { min-width: 0; min-height: 34px;
                                    padding: 7px 10px; font-size: 0.78rem;
                                    gap: 4px; border-radius: 18px; }
    #moonOverlay .game-header-right { gap: 8px; }
    #moonOverlay .moon-time       { font-size: 0.78rem; padding: 3px 8px;
                                    min-width: 78px; }

    /* 说明文字固定到底部，不占中间空间 */
    #moonOverlay .game-instruction {
        position: absolute;
        left: 0; right: 0; bottom: 6px;
        margin: 0;
        padding: 0 10px;
        text-align: center;
        font-size: 0.68rem;
    }

    /* 舞台：flex 居中容器，margin 预留头部/说明位置 */
    .moon-stage {
        position: relative;
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        margin: 48px 0 30px;
        box-sizing: border-box;
    }
    /* 画布：按 aspect-ratio + max 自适应舞台，保持 880:660（1.33:1），
       边框/底色/阴影由基础样式提供，游戏本身始终有清晰外框 */
    #moonCanvas {
        width: auto;
        height: auto;
        max-width: 100%;
        max-height: 100%;
        aspect-ratio: 880 / 660;
    }

    /* HUD 数值紧凑 */
    #moonOverlay .moon-stats2 { gap: 8px; font-size: 0.82rem; }
    .moon-hp-label  { display: none; }
    .moon-hp-track  { width: 70px; height: 8px; }
    .moon-level     { padding: 1px 7px; font-size: 0.74em; }
    .moon-warning   { font-size: 1.1rem; top: 22%; }
    .moon-warning-warn,
    .moon-warning-level { font-size: 0.95rem; }
    .moon-bossbar-head { font-size: 0.7rem; }

    /* 弹窗在窄屏上撑满可用宽度 */
    #moonOverlay .game-over-panel,
    #moonOverlay .game-help-panel {
        max-width: calc(100vw - 20px);
        width: calc(100vw - 20px);
        padding: 22px 18px;
        box-sizing: border-box;
    }
    #moonOverlay .game-over-panel h2        { font-size: 1.35rem; }
    #moonOverlay .game-over-panel .final-score { font-size: 1.15rem; }
    #moonOverlay .game-over-panel .game-over-stats { font-size: 0.82rem; }

    .moon-dying-text        { font-size: 1.9rem; top: 36%; }
    .moon-revive-countdown  { font-size: 4.5rem; top: 36%; }
}

/* 超窄屏（max-width: 480px）进一步压缩 */
@media (max-width: 480px) {
    #moonOverlay .game-header { font-size: 0.7rem; padding: 4px 8px;
                                column-gap: 6px; }
    .moon-stage      { margin: 42px 0 26px; }
    .moon-hp-track   { width: 56px; height: 7px; }
    .moon-revive-countdown { font-size: 3.6rem; }
    .moon-dying-text { font-size: 1.5rem; }
    /* 超窄屏：按钮只保留图标（文字隐藏但 title/aria 保留可访问性），
       宽度大幅缩小，彻底避免与 HUD 重叠 */
    #moonOverlay .btn-close {
        min-width: 40px;
        min-height: 36px;
        padding: 6px 8px;
        font-size: 1rem;
        gap: 0;
        border-radius: 14px;
    }
    #moonOverlay .btn-close .btn-txt { display: none; }
    #moonOverlay .moon-time {
        min-width: 64px;
        font-size: 0.7rem;
        padding: 3px 6px;
    }
}

@media (max-width: 560px) {
    #moonOverlay .game-header {
        padding: 0 12px;
        font-size: 0.82rem;
        column-gap: 8px;
    }
    #moonOverlay .game-stats {
        gap: 10px;
    }
    #moonOverlay .game-header-actions {
        gap: 6px;
    }
    #moonOverlay .game-header-right { gap: 8px; }
    #moonOverlay .moon-time { font-size: 0.75rem; padding: 3px 8px;
                               min-width: 72px; }
    #moonOverlay .btn-close {
        padding: 7px 9px;
        font-size: 0.75rem;
        min-width: 0;
        min-height: 32px;
        gap: 3px;
    }
    #moonOverlay .moon-hud { min-width: 0; }
    #moonOverlay .game-over-panel,
    #moonOverlay .game-help-panel {
        padding: 24px 20px;
    }
    #moonOverlay .game-over-panel h2 {
        font-size: 1.45rem;
    }
    #moonOverlay .game-instruction {
        font-size: 0.72rem;
    }
    #moonOverlay .moon-stats2 {
        gap: 9px;
    }
    .moon-hp-label {
        display: none;
    }
    .moon-hp-track {
        width: 74px;
        height: 9px;
    }
    .moon-level {
        padding: 1px 8px;
        font-size: 0.8em;
    }
    .moon-warning {
        font-size: 1.2rem;
    }
    .moon-warning-warn,
    .moon-warning-level {
        font-size: 1rem;
    }
    .moon-bossbar-head {
        font-size: 0.7rem;
    }
}
