* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
}

button, .menu-btn, .ui-btn, .reward-card, .forge-card, .shop-item, .guide-tab, .artifact-card {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

body {
    overflow: hidden;
    min-height: 100dvh;
    background: #1a1a2e;
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

canvas {
    display: block;
    cursor: crosshair;
    touch-action: none;
}

/* 主菜单 */
#menu-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 80;
    background: rgba(50,40,30,0.92);
    display: flex;
    align-items: center;
    justify-content: center;
}

#menu-content {
    text-align: center;
}

#menu-title {
    font-size: 56px;
    color: #eeddcc;
    font-family: "KaiTi", "STKaiti", "Microsoft YaHei";
    letter-spacing: 12px;
    margin-bottom: 12px;
    text-shadow: 0 0 20px rgba(200,180,140,0.3), 2px 2px 4px rgba(0,0,0,0.4);
}

#menu-subtitle {
    color: #bbaa88;
    font-size: 16px;
    font-family: "KaiTi", "STKaiti", "Microsoft YaHei";
    margin-bottom: 40px;
    letter-spacing: 4px;
}

#menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: center;
    margin-bottom: 30px;
}

.menu-btn {
    width: 200px;
    padding: 12px 0;
    font-size: 18px;
    font-weight: bold;
    color: #3a3028;
    background: rgba(220,210,190,0.7);
    border: 1px solid rgba(180,160,120,0.5);
    border-radius: 8px;
    cursor: pointer;
    font-family: "KaiTi", "STKaiti", "Microsoft YaHei";
    letter-spacing: 4px;
    transition: all 0.2s;
}

.menu-btn:hover {
    background: rgba(230,220,200,0.9);
    border-color: rgba(180,160,120,0.7);
    transform: scale(1.03);
}

.menu-btn-secondary {
    font-size: 14px;
    padding: 8px 0;
    color: #bbaa88;
    background: rgba(220,210,190,0.25);
    border-color: rgba(180,160,120,0.3);
    letter-spacing: 2px;
}

.menu-btn-secondary:hover {
    background: rgba(220,210,190,0.45);
}

#menu-records {
    background: rgba(60,50,35,0.3);
    border: 1px solid rgba(100,80,50,0.2);
    border-radius: 8px;
    padding: 16px 30px;
    margin-bottom: 20px;
    display: inline-block;
}

.record-row {
    color: #bbaa88;
    font-size: 14px;
    line-height: 2;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    font-family: "KaiTi", "STKaiti", "Microsoft YaHei";
}

.record-row span {
    color: #eeddcc;
    font-weight: bold;
}

#menu-about {
    background: rgba(60,50,35,0.3);
    border: 1px solid rgba(100,80,50,0.2);
    border-radius: 8px;
    padding: 16px 30px;
    margin-bottom: 20px;
    display: inline-block;
    text-align: center;
}

.about-content {
    font-family: "KaiTi", "STKaiti", "Microsoft YaHei";
}

.about-title {
    color: #eeddcc;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 8px;
}

.about-line {
    color: #bbaa88;
    font-size: 13px;
    line-height: 1.8;
}

.about-line b {
    color: #eeddcc;
}

.about-link {
    margin-top: 8px;
}

.about-link a {
    color: #8ab4e8;
    text-decoration: none;
    font-size: 13px;
}

.about-link a:hover {
    color: #aac8f0;
    text-decoration: underline;
}

#menu-hint {
    color: #998877;
    font-size: 12px;
    margin-top: 10px;
    animation: menuHintPulse 2s ease-in-out infinite;
}

@keyframes menuHintPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}

/* 修炼指南面板 */
#guide-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    z-index: 85;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(18, 12, 8, 0.62);
}

#guide-inner {
    width: min(560px, calc(100vw - 32px));
    max-height: min(680px, calc(100dvh - 48px));
    display: flex;
    flex-direction: column;
    background: rgba(229,220,201,0.98);
    border: 1px solid rgba(110,86,54,0.36);
    border-radius: 16px;
    box-shadow: 0 22px 48px rgba(12, 8, 5, 0.35);
    overflow: hidden;
}

#guide-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px 10px;
    border-bottom: 1px solid rgba(110,86,54,0.18);
}

#guide-header span {
    font-size: 20px;
    font-weight: bold;
    color: #3a3028;
    font-family: "KaiTi", "STKaiti", "Microsoft YaHei";
    letter-spacing: 6px;
}

#guide-tabs {
    display: flex;
    border-bottom: 1px solid rgba(110,86,54,0.18);
    overflow-x: auto;
    scrollbar-width: none;
}

#guide-tabs::-webkit-scrollbar { display: none; }

.guide-tab {
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: bold;
    color: #8a7356;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-family: "KaiTi", "STKaiti", "Microsoft YaHei";
    letter-spacing: 2px;
    transition: all 0.15s;
}

.guide-tab:hover {
    color: #3a3028;
    background: rgba(100,80,50,0.06);
}

.guide-tab.active {
    color: #3a3028;
    border-bottom-color: #8a6a20;
    background: rgba(100,80,50,0.08);
}

#guide-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 14px 18px 18px;
}

.guide-page {
    display: none;
}

.guide-page.active {
    display: block;
}

.guide-page h3 {
    font-size: 15px;
    color: #3a3028;
    margin: 16px 0 8px;
    font-family: "KaiTi", "STKaiti", "Microsoft YaHei";
    letter-spacing: 2px;
    border-left: 3px solid #8a6a20;
    padding-left: 8px;
}

.guide-page h3:first-child {
    margin-top: 0;
}

.guide-page p {
    font-size: 13px;
    color: #554433;
    line-height: 1.85;
    margin: 4px 0;
}

.guide-page p b {
    color: #3a3028;
}

/* 加成列表面板 */
#buff-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    z-index: 55;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 80px 12px 12px 12px;
    pointer-events: none;
}

#buff-panel > * { pointer-events: auto; }

#buff-inner {
    width: 240px;
    max-height: min(60dvh, calc(100dvh - 110px));
    overflow-y: auto;
    background: rgba(220,210,190,0.95);
    border: 1px solid rgba(100,80,50,0.3);
    border-radius: 8px;
    padding: 12px;
}

#buff-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

#buff-header span {
    font-size: 15px;
    font-weight: bold;
    color: #3a3028;
    font-family: "KaiTi", "STKaiti", "Microsoft YaHei";
}

.buff-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid rgba(100,80,50,0.1);
    font-size: 12px;
}

.buff-item:last-child { border-bottom: none; }

.buff-item-name { color: #3a3028; }
.buff-item-desc { color: #776655; font-size: 11px; }

#btn-buff-list {
    margin-top: 6px;
    padding: 6px 12px;
    font-size: 13px;
    color: #bbaa88;
    background: rgba(40,32,22,0.6);
    border: 1px solid rgba(80,60,40,0.2);
    border-radius: 6px;
    cursor: pointer;
    font-family: "KaiTi", "STKaiti", "Microsoft YaHei";
    width: 100%;
    text-align: center;
}

#btn-buff-list:hover {
    background: rgba(60,48,30,0.7);
}

/* UI 覆盖层 */
#ui-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    pointer-events: none;
    z-index: 10;
}

#ui-overlay > * {
    pointer-events: auto;
}

/* 左上信息面板 */
#left-panel {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#hp-bar-container {
    position: relative;
    width: 240px;
    height: 32px;
}

#hp-bg {
    width: 100%;
    height: 100%;
    object-fit: fill;
}

#hp-bar-fill {
    position: absolute;
    top: 50%;
    left: 12%;
    transform: translateY(-50%);
    width: 76%;
    height: 30%;
    background: linear-gradient(180deg, rgba(160,40,30,0.8) 0%, rgba(120,30,20,0.9) 100%);
    border-radius: 2px;
    transition: width 0.15s ease;
}

#hp-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 13px;
    font-weight: bold;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.9);
}

#coin-display {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(40,32,22,0.7);
    border: 1px solid rgba(80,60,40,0.2);
    border-radius: 12px;
    padding: 4px 12px 4px 5px;
    width: fit-content;
}

#coin-icon {
    width: 26px;
    height: 26px;
}

#coin-text {
    color: #eedd77;
    font-size: 17px;
    font-weight: bold;
}

#damage-display {
    background: rgba(40,32,22,0.7);
    border: 1px solid rgba(80,60,40,0.2);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    color: #bbaa88;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    line-height: 1.6;
}

.stat-row span {
    color: #eedd99;
    font-weight: bold;
}

/* 顶部居中 */
#top-center {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    min-width: 220px;
}

#timer {
    color: #3a3028;
    font-size: 30px;
    font-weight: bold;
    font-family: "KaiTi", "STKaiti", "Microsoft YaHei";
    letter-spacing: 4px;
}

#realm {
    color: #554433;
    font-size: 16px;
    margin-top: 2px;
    font-family: "KaiTi", "STKaiti", "Microsoft YaHei";
}

/* Boss 倒计时条 */
#boss-timer-bar {
    position: absolute;
    top: 82px;
    left: 50%;
    transform: translateX(-50%);
    width: 280px;
    height: 22px;
    background: rgba(62,48,36,0.68);
    border: 1px solid rgba(122,78,40,0.45);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 18px rgba(25, 18, 12, 0.18);
}

#boss-timer-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, rgba(140,40,30,0.7), rgba(180,40,30,0.9));
    transition: width 0.5s linear;
    border-radius: 10px;
}

#boss-timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #eeddcc;
    font-size: 13px;
    font-weight: bold;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
    white-space: nowrap;
}

/* 右上按钮 */
#right-panel {
    position: absolute;
    top: 14px;
    right: 14px;
    display: flex;
    gap: 10px;
}

.ui-btn {
    width: 46px;
    height: 46px;
    border: 1px solid rgba(71,92,102,0.6);
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(48,67,78,0.94) 0%, rgba(29,42,50,0.96) 100%);
    color: #f2dfb0;
    font-size: 17px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    box-shadow: 0 8px 18px rgba(18, 26, 31, 0.24);
}

.ui-btn:hover {
    background: linear-gradient(180deg, rgba(60,82,94,0.96) 0%, rgba(37,53,62,0.98) 100%);
    border-color: rgba(120,150,166,0.7);
    color: #fff2c8;
    transform: translateY(-1px);
}

.ui-btn.active {
    background: linear-gradient(180deg, rgba(92,140,86,0.96) 0%, rgba(60,101,53,0.96) 100%);
    border-color: rgba(152,212,139,0.7);
    color: #efffdc;
}

/* 底部属性栏 */
#bottom-bar {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 28px;
    background: rgba(40,32,22,0.75);
    border: 1px solid rgba(80,60,40,0.3);
    border-radius: 12px;
    padding: 10px 28px;
}

.stat-item {
    color: #bbaa88;
    font-size: 15px;
    letter-spacing: 1px;
}

.stat-item span {
    color: #eedd99;
    font-weight: bold;
    margin-left: 4px;
}

/* Boss 警告 */
#boss-warning {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    pointer-events: none;
}

#boss-warning span {
    font-size: 44px;
    font-weight: bold;
    color: #6a2020;
    font-family: "KaiTi", "STKaiti", "Microsoft YaHei";
    letter-spacing: 10px;
    animation: bossWarning 1.8s ease-out forwards;
    white-space: nowrap;
}

@keyframes bossWarning {
    0% { opacity: 0; transform: scale(1.5); }
    20% { opacity: 1; transform: scale(1); }
    80% { opacity: 1; }
    100% { opacity: 0; transform: scale(0.95); }
}

/* 天魔降临出场特效 */
#qilin-intro {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    z-index: 200;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

#qilin-intro-bg {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(80,10,10,0.9) 0%, rgba(0,0,0,0.95) 70%);
    animation: qilinBgIn 0.6s ease-out forwards;
}

@keyframes qilinBgIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

#qilin-intro-text {
    position: relative;
    z-index: 1;
    text-align: center;
}

#qilin-intro-title {
    font-size: 72px;
    font-weight: bold;
    color: #ffd700;
    font-family: "KaiTi", "STKaiti", "Microsoft YaHei";
    letter-spacing: 20px;
    text-shadow: 0 0 40px rgba(255,180,30,0.6), 0 0 80px rgba(255,100,0,0.3), 2px 2px 6px rgba(0,0,0,0.8);
    animation: qilinTitleIn 1.2s ease-out forwards;
    opacity: 0;
}

@keyframes qilinTitleIn {
    0% { opacity: 0; transform: scale(2.5) translateY(-20px); }
    40% { opacity: 1; transform: scale(1) translateY(0); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

#qilin-intro-sub {
    font-size: 22px;
    color: #cc8844;
    font-family: "KaiTi", "STKaiti", "Microsoft YaHei";
    letter-spacing: 8px;
    margin-top: 16px;
    text-shadow: 0 0 20px rgba(200,120,30,0.4);
    animation: qilinSubIn 1s ease-out 0.5s forwards;
    opacity: 0;
}

@keyframes qilinSubIn {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* 伤害里程碑 */
/* 神器面板 */
#artifact-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    z-index: 60;
    background: rgba(30,15,40,0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
    backdrop-filter: blur(2px);
}

#artifact-title {
    font-size: 32px;
    font-weight: bold;
    color: #dd8830;
    font-family: "KaiTi", "STKaiti", "Microsoft YaHei";
    letter-spacing: 8px;
    margin-bottom: 24px;
    text-shadow: 0 0 20px rgba(200,120,30,0.4);
}

#artifact-cards {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
    width: min(100%, 980px);
}

#btn-artifact {
    position: fixed;
    bottom: 160px;
    right: 16px;
    z-index: 20;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: bold;
    color: #ffd700;
    background: radial-gradient(circle, rgba(200,120,30,0.6) 0%, rgba(160,80,20,0.8) 100%);
    border: 2px solid rgba(255,200,80,0.6);
    cursor: pointer;
    font-family: "KaiTi", "STKaiti", "Microsoft YaHei";
    transition: all 0.2s;
    box-shadow: 0 0 15px rgba(200,120,30,0.4);
}

#btn-artifact:hover {
    transform: scale(1.1);
    box-shadow: 0 0 25px rgba(200,120,30,0.6);
}

#btn-artifact.on-cooldown {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: rgba(100,80,50,0.3);
}

.pet-chip-img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    vertical-align: -3px;
    margin-right: 4px;
    mix-blend-mode: multiply;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.18)) contrast(1.06) saturate(1.04);
}

/* 暂停提示 */
#pause-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    z-index: 55;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.3);
    pointer-events: none;
}

#pause-overlay span {
    font-size: 56px;
    font-weight: bold;
    color: rgba(220,210,190,0.7);
    font-family: "KaiTi", "STKaiti", "Microsoft YaHei";
    letter-spacing: 16px;
    text-shadow: 0 0 20px rgba(0,0,0,0.3);
}

#milestone {
    position: fixed;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    pointer-events: none;
    font-size: 36px;
    font-weight: bold;
    color: #3a3028;
    font-family: "KaiTi", "STKaiti", "Microsoft YaHei";
    animation: milestoneAnim 1.5s ease-out forwards;
    white-space: nowrap;
}

@keyframes milestoneAnim {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
    40% { transform: translate(-50%, -50%) scale(1); }
    80% { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -60%) scale(1); }
}

/* 坊市按钮 */
#btn-shop {
    position: fixed;
    bottom: 28px;
    right: 20px;
    z-index: 20;
    min-width: 128px;
    min-height: 52px;
    padding: 12px 22px;
    font-size: 18px;
    font-weight: bold;
    color: #f6ead0;
    background: linear-gradient(180deg, rgba(90,72,44,0.94) 0%, rgba(62,48,28,0.96) 100%);
    border: 1px solid rgba(188,153,88,0.52);
    border-radius: 12px;
    cursor: pointer;
    font-family: "KaiTi", "STKaiti", "Microsoft YaHei";
    transition: all 0.15s;
    box-shadow: 0 12px 28px rgba(32, 24, 14, 0.22);
}

#btn-shop:hover {
    background: linear-gradient(180deg, rgba(110,88,54,0.96) 0%, rgba(76,58,34,0.98) 100%);
    border-color: rgba(225,186,112,0.66);
    transform: translateY(-2px);
}

@media (min-width: 1600px) {
    #left-panel {
        top: 18px;
        left: 18px;
        transform: scale(1.16);
        transform-origin: top left;
    }

    #top-center {
        top: 18px;
        transform: translateX(-50%) scale(1.14);
        transform-origin: top center;
    }

    #boss-timer-bar {
        top: 106px;
        width: 340px;
        height: 26px;
    }

    #right-panel {
        top: 20px;
        right: 20px;
        gap: 12px;
    }

    .ui-btn {
        width: 52px;
        height: 52px;
        font-size: 19px;
    }

    #bottom-bar {
        bottom: 18px;
        gap: 34px;
        padding: 14px 34px;
        transform: translateX(-50%) scale(1.12);
        transform-origin: bottom center;
    }

    #btn-shop {
        bottom: 32px;
        right: 24px;
        min-width: 142px;
        min-height: 58px;
        padding: 14px 24px;
        font-size: 20px;
    }

    #btn-challenge-boss {
        bottom: 100px;
        right: 24px;
        min-width: 142px;
        min-height: 58px;
        padding: 14px 20px;
        font-size: 18px;
    }

    #btn-artifact {
        bottom: 172px;
        right: 24px;
        width: 72px;
        height: 72px;
        font-size: 13px;
    }
}

#btn-challenge-boss {
    position: fixed;
    bottom: 92px;
    right: 20px;
    z-index: 20;
    min-width: 128px;
    min-height: 52px;
    padding: 12px 18px;
    font-size: 16px;
    font-weight: bold;
    color: #fff0d8;
    background: linear-gradient(135deg, rgba(160,48,38,0.92) 0%, rgba(114,26,20,0.96) 100%);
    border: 1px solid rgba(236,124,92,0.68);
    border-radius: 12px;
    cursor: pointer;
    font-family: "KaiTi", "STKaiti", "Microsoft YaHei";
    transition: all 0.15s;
    animation: challengeGlow 2s ease-in-out infinite;
    box-shadow: 0 12px 28px rgba(68, 18, 12, 0.26);
}

#btn-challenge-boss:hover {
    background: linear-gradient(135deg, rgba(184,58,48,0.96) 0%, rgba(132,34,24,0.98) 100%);
    transform: translateY(-2px);
}

@keyframes challengeGlow {
    0%, 100% { box-shadow: 0 0 5px rgba(200,50,30,0.3); }
    50% { box-shadow: 0 0 15px rgba(200,50,30,0.5); }
}

/* 商店面板 */
#shop-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    padding: 16px;
}

#shop-panel > * {
    pointer-events: auto;
}

#shop-inner {
    width: min(480px, calc(100vw - 32px));
    max-height: min(85dvh, calc(100dvh - 32px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: rgba(220,210,190,0.95);
    border: 1px solid rgba(100,80,50,0.3);
    border-radius: 10px;
    padding: 16px;
}

#shop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

#shop-header span {
    font-size: 20px;
    font-weight: bold;
    color: #3a3028;
    font-family: "KaiTi", "STKaiti", "Microsoft YaHei";
    letter-spacing: 6px;
}

#shop-refresh-timer {
    color: #887766;
    font-size: 11px;
}

#shop-items {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.shop-item {
    flex: 1 1 calc(50% - 10px);
    min-width: 160px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: rgba(240,232,216,0.6);
    border: 1px solid rgba(100,80,50,0.2);
    border-radius: 6px;
    padding: 8px 8px;
    cursor: pointer;
    transition: all 0.15s;
    min-height: 80px;
}

.shop-item:hover {
    border-color: rgba(100,80,50,0.4);
    background: rgba(240,232,216,0.8);
}

.shop-item.sold {
    opacity: 0.35;
    cursor: not-allowed;
    border-color: rgba(100,80,50,0.1);
}

.shop-item-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.shop-item-name {
    color: #3a3028;
    font-size: 13px;
    font-weight: bold;
    font-family: "KaiTi", "STKaiti", "Microsoft YaHei";
}

.shop-item-desc {
    color: #776655;
    font-size: 11px;
    line-height: 1.4;
}

.shop-item-price {
    color: #8a7040;
    font-size: 13px;
    font-weight: bold;
    text-align: center;
    margin-top: 6px;
}

.shop-item-left .rarity-common { color: #665544; }
.shop-item-left .rarity-uncommon { color: #4a7a3a; }
.shop-item-left .rarity-rare { color: #3a6a8a; }
.shop-item-left .rarity-epic { color: #7a4a8a; }
.shop-item-left .rarity-legendary { color: #8a6a20; }

.reward-card-name.rarity-common { color: #665544; }
.reward-card-name.rarity-uncommon { color: #4a7a3a; }
.reward-card-name.rarity-rare { color: #3a6a8a; }
.reward-card-name.rarity-epic { color: #7a4a8a; }
.reward-card-name.rarity-legendary { color: #8a6a20; }

#btn-shop-refresh, #btn-shop-close {
    width: 100%;
    padding: 7px;
    font-size: 12px;
    font-weight: bold;
    border: 1px solid rgba(100,80,50,0.2);
    border-radius: 5px;
    cursor: pointer;
    font-family: "KaiTi", "STKaiti", "Microsoft YaHei";
    margin-top: 4px;
}

#btn-shop-refresh {
    background: rgba(80,60,35,0.3);
    color: #554433;
    border-color: rgba(100,80,50,0.3);
}

#btn-shop-refresh:hover {
    background: rgba(100,75,40,0.4);
}

#btn-shop-close {
    background: rgba(100,90,75,0.2);
    color: #776655;
}

#btn-shop-close:hover {
    background: rgba(100,90,75,0.35);
    color: #554433;
}

#forge-section {
    margin-top: 8px;
    border-top: 1px solid rgba(100,80,50,0.2);
    padding-top: 8px;
}

#btn-forge {
    width: 100%;
    padding: 10px;
    font-size: 14px;
    font-weight: bold;
    color: #3a3028;
    background: linear-gradient(135deg, rgba(180,140,60,0.3) 0%, rgba(200,160,80,0.4) 100%);
    border: 1px solid rgba(180,140,60,0.4);
    border-radius: 6px;
    cursor: pointer;
    font-family: "KaiTi", "STKaiti", "Microsoft YaHei";
    transition: all 0.15s;
}

#btn-forge:hover {
    background: linear-gradient(135deg, rgba(180,140,60,0.5) 0%, rgba(200,160,80,0.6) 100%);
}

#btn-forge-premium {
    width: 100%;
    padding: 10px;
    font-size: 14px;
    font-weight: bold;
    color: #5a3080;
    background: linear-gradient(135deg, rgba(120,60,160,0.2) 0%, rgba(160,80,200,0.3) 100%);
    border: 1px solid rgba(120,60,160,0.4);
    border-radius: 6px;
    cursor: pointer;
    font-family: "KaiTi", "STKaiti", "Microsoft YaHei";
    transition: all 0.15s;
    margin-top: 6px;
}

#btn-forge-premium:hover {
    background: linear-gradient(135deg, rgba(120,60,160,0.4) 0%, rgba(160,80,200,0.5) 100%);
}

/* 锻造面板 */
#forge-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    z-index: 60;
    background: rgba(50,40,30,0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
    backdrop-filter: blur(2px);
}

#forge-title {
    font-size: 32px;
    font-weight: bold;
    color: #ddc080;
    font-family: "KaiTi", "STKaiti", "Microsoft YaHei";
    letter-spacing: 8px;
    margin-bottom: 24px;
    text-shadow: 0 0 15px rgba(200,160,60,0.3);
}

#forge-cards {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
    width: min(100%, 980px);
}

.forge-card-inner {
    width: 180px;
    height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    text-align: center;
    background: linear-gradient(135deg, rgba(220,210,190,0.9) 0%, rgba(200,190,170,0.9) 100%);
    border: 1px solid rgba(100,80,50,0.3);
    border-radius: 8px;
}

.forge-card-rarity {
    font-size: 12px;
    font-family: "KaiTi", "STKaiti", "Microsoft YaHei";
}

.forge-card-name {
    font-size: 16px;
    font-weight: bold;
    color: #3a3028;
    font-family: "KaiTi", "STKaiti", "Microsoft YaHei";
}

.forge-card-desc {
    font-size: 13px;
    color: #554433;
    line-height: 1.5;
}

.forge-card-info {
    bottom: 26px;
    left: 18px;
    right: 18px;
    min-height: 98px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.shop-close-x {
    width: 28px;
    height: 28px;
    border: 1px solid rgba(100,80,50,0.3);
    border-radius: 6px;
    background: rgba(120,40,30,0.15);
    color: #884433;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-family: inherit;
    flex-shrink: 0;
}

.shop-close-x:hover {
    background: rgba(120,40,30,0.3);
    color: #6a2020;
}

/* Boss 奖励选择 */
#reward-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    z-index: 60;
    background: rgba(50,40,30,0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

#reward-title {
    font-size: 32px;
    font-weight: bold;
    color: #3a3028;
    font-family: "KaiTi", "STKaiti", "Microsoft YaHei";
    letter-spacing: 8px;
    margin-bottom: 30px;
    animation: rewardTitle 0.5s ease-out;
}

@keyframes rewardTitle {
    0% { opacity: 0; transform: translateY(-30px); }
    100% { opacity: 1; transform: translateY(0); }
}

#reward-cards {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
    width: min(100%, 980px);
}

.reward-card {
    width: 180px;
    height: 252px;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
    animation: cardAppear 0.4s ease-out backwards;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid rgba(110, 82, 52, 0.36);
    box-shadow: 0 12px 28px rgba(35, 24, 16, 0.24);
}

.reward-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url("images/cards/putong.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.reward-card::after {
    content: "";
    position: absolute;
    inset: 8px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.24);
    pointer-events: none;
}

.reward-common::before {
    background-image: url("images/cards/putong.png");
}

.reward-uncommon::before {
    background-image: url("images/cards/youxiu.png");
}

.reward-rare::before {
    background-image: url("images/cards/xiyou.png");
}

.reward-epic::before {
    background-image: url("images/cards/shishi.png");
}

.reward-legendary::before {
    background-image: url("images/cards/chuanshuo.png");
}

.reward-card:nth-child(1) { animation-delay: 0.1s; }
.reward-card:nth-child(2) { animation-delay: 0.25s; }
.reward-card:nth-child(3) { animation-delay: 0.4s; }

@keyframes cardAppear {
    0% { opacity: 0; transform: translateY(40px) scale(0.8); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.reward-card:hover {
    transform: translateY(-10px) scale(1.05);
}

.reward-card-img {
    display: none;
}

.reward-card-info {
    position: absolute;
    bottom: 30px;
    left: 20px;
    right: 20px;
    z-index: 1;
    background: rgba(248,242,231,0.68);
    backdrop-filter: blur(2px);
    padding: 12px 10px;
    text-align: center;
    border-radius: 6px;
    border: 1px solid rgba(120, 92, 58, 0.16);
}

.artifact-choice-img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    display: block;
    margin: 0 auto 6px;
    mix-blend-mode: multiply;
    filter: drop-shadow(0 4px 10px rgba(60, 30, 10, 0.28)) contrast(1.06) saturate(1.04);
}

.reward-card-name {
    color: #3a3028;
    font-size: 15px;
    font-weight: bold;
    font-family: "KaiTi", "STKaiti", "Microsoft YaHei";
}

.reward-card-type {
    color: #776655;
    font-size: 11px;
    margin-top: 4px;
}

.reward-card-desc {
    color: #554433;
    font-size: 11px;
    margin-top: 6px;
    line-height: 1.4;
}

/* 结算界面 */
#gameover-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    z-index: 70;
    background: rgba(50,40,30,0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#gameover-panel h1 {
    font-size: 40px;
    color: #cc6644;
    font-family: "KaiTi", "STKaiti", "Microsoft YaHei";
    margin-bottom: 24px;
    letter-spacing: 10px;
    text-shadow: 0 0 20px rgba(180,60,30,0.3);
}

#gameover-stats {
    color: #bbaa88;
    font-size: 14px;
    line-height: 2.2;
    text-align: center;
    margin-bottom: 28px;
    background: rgba(60,50,35,0.4);
    border: 1px solid rgba(100,80,50,0.2);
    border-radius: 10px;
    padding: 20px 40px;
}

#gameover-stats .highlight {
    color: #eedd99;
    font-weight: bold;
}

#btn-restart {
    padding: 10px 32px;
    font-size: 15px;
    font-weight: bold;
    color: #3a3028;
    background: rgba(220,210,190,0.6);
    border: 1px solid rgba(180,160,120,0.4);
    border-radius: 8px;
    cursor: pointer;
    font-family: "KaiTi", "STKaiti", "Microsoft YaHei";
    transition: all 0.15s;
}

#btn-restart:hover {
    background: rgba(230,220,200,0.85);
    border-color: rgba(180,160,120,0.6);
}

.hidden {
    display: none !important;
}

/* 屏幕泛红效果 */
.screen-red {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    background: radial-gradient(ellipse at center, transparent 50%, rgba(120,30,20,0.2) 100%);
    animation: screenRed 0.3s ease-out forwards;
}

@keyframes screenRed {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* ==========================================
   移动端适配
   ========================================== */
@media (max-width: 768px) {
    /* 左上信息面板 - 紧凑 */
    #left-panel {
        top: calc(6px + env(safe-area-inset-top, 0px));
        left: 6px;
        gap: 4px;
        transform: scale(0.72);
        transform-origin: top left;
    }

    #hp-bar-container {
        width: 208px;
        height: 28px;
    }

    #hp-text {
        font-size: 11px;
    }

    #coin-display {
        gap: 5px;
        padding: 4px 10px 4px 5px;
        border-radius: 10px;
    }

    #coin-icon {
        width: 22px;
        height: 22px;
    }

    #coin-text {
        font-size: 15px;
    }

    #damage-display {
        padding: 7px 10px;
        font-size: 11px;
    }

    /* 顶部居中 */
    #top-center {
        top: calc(4px + env(safe-area-inset-top, 0px));
        min-width: 140px;
    }

    #timer {
        font-size: 20px;
        letter-spacing: 2px;
    }

    #realm {
        font-size: 11px;
    }

    /* Boss 计时条 */
    #boss-timer-bar {
        top: calc(56px + env(safe-area-inset-top, 0px));
        width: min(240px, 56vw);
        height: 16px;
        font-size: 10px;
    }

    /* 右上按钮 - 更大触摸目标 */
    #right-panel {
        top: calc(6px + env(safe-area-inset-top, 0px));
        right: 6px;
        gap: 8px;
    }

    .ui-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
        border-radius: 11px;
    }

    /* 底部属性栏 - 紧凑 */
    #bottom-bar {
        bottom: calc(6px + env(safe-area-inset-bottom, 0px));
        gap: 8px;
        padding: 6px 10px;
        font-size: 11px;
        flex-wrap: nowrap;
        overflow-x: auto;
        width: calc(100vw - 14px);
        max-width: calc(100vw - 14px);
        justify-content: flex-start;
        border-radius: 14px;
    }

    .stat-item {
        font-size: 11px;
        white-space: nowrap;
    }

    /* 坊市按钮 */
    #btn-shop {
        bottom: calc(58px + env(safe-area-inset-bottom, 0px));
        right: 10px;
        min-width: 88px;
        min-height: 46px;
        padding: 8px 14px;
        font-size: 15px;
        border-radius: 14px;
    }

    /* 挑战 Boss 按钮 */
    #btn-challenge-boss {
        bottom: calc(110px + env(safe-area-inset-bottom, 0px));
        right: 10px;
        min-width: 88px;
        min-height: 50px;
        padding: 8px 14px;
        font-size: 15px;
        border-radius: 14px;
    }

    /* 神器按钮 */
    #btn-artifact {
        bottom: calc(170px + env(safe-area-inset-bottom, 0px));
        right: 12px;
        width: 50px;
        height: 50px;
        font-size: 11px;
    }

    /* 商店面板 */
    #shop-panel,
    #reward-panel,
    #forge-panel,
    #artifact-panel {
        align-items: center;
        justify-content: flex-start;
        padding:
            calc(12px + env(safe-area-inset-top, 0px))
            10px
            calc(12px + env(safe-area-inset-bottom, 0px));
    }

    #shop-inner {
        width: 100%;
        max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 24px);
        padding: 12px;
        border-radius: 14px;
    }

    #shop-header span {
        font-size: 17px;
        letter-spacing: 4px;
    }

    #shop-refresh-timer {
        font-size: 10px;
    }

    #shop-items {
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 8px;
    }

    .shop-item {
        flex: 1 1 auto;
        min-width: 0;
        min-height: 74px;
        padding: 8px 10px;
        font-size: 12px;
    }

    .shop-item-name {
        font-size: 13px;
    }

    .shop-item-desc {
        font-size: 11px;
    }

    /* 奖励选择面板 */
    #reward-title, #forge-title, #artifact-title {
        font-size: 22px;
        padding: 0;
        margin-bottom: 0;
        text-align: center;
        letter-spacing: 4px;
    }

    #reward-cards,
    #forge-cards,
    #artifact-cards {
        width: min(100%, 360px);
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: center;
        gap: 12px;
    }

    .reward-card {
        width: 100%;
        max-width: 320px;
        height: 220px;
    }

    .reward-card-info {
        left: 16px;
        right: 16px;
        bottom: 20px;
        padding: 10px 8px;
    }

    .forge-card-inner {
        width: min(100%, 320px);
        min-height: 184px;
        height: auto;
        padding: 14px 12px;
        gap: 8px;
    }

    .reward-card-name, .forge-card-name {
        font-size: 14px;
    }

    .reward-card-desc, .forge-card-desc {
        font-size: 11px;
    }

    /* 主菜单 */
    #menu-title {
        font-size: 32px;
    }

    #menu-subtitle {
        font-size: 13px;
    }

    .menu-btn {
        padding: 12px 32px;
        font-size: 16px;
    }

    /* 修炼指南 */
    #guide-inner {
        width: calc(100vw - 20px);
        max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 20px);
    }

    #guide-body {
        font-size: 13px;
        line-height: 1.8;
    }

    .guide-tab {
        padding: 6px 10px;
        font-size: 12px;
    }

    /* 加成面板 */
    #buff-inner {
        width: min(220px, calc(100vw - 20px));
        font-size: 12px;
    }

    /* 游戏结束 */
    #gameover-panel h1 {
        font-size: 28px;
    }

    #gameover-stats {
        font-size: 13px;
    }

    /* Boss 警告 */
    #boss-warning span {
        font-size: 28px;
        letter-spacing: 6px;
    }

    /* 麒麟出场 */
    #qilin-intro-title {
        font-size: 36px;
    }

    #qilin-intro-sub {
        font-size: 14px;
    }

    /* 里程碑 */
    #milestone {
        font-size: 24px;
    }

    /* 暂停 */
    #pause-overlay span {
        font-size: 36px;
        letter-spacing: 10px;
    }
}

@media (max-width: 480px) {
    #left-panel {
        transform: scale(0.62);
    }

    #bottom-bar {
        gap: 6px;
        padding: 4px 8px;
        font-size: 10px;
        width: calc(100vw - 10px);
        max-width: calc(100vw - 10px);
    }

    .stat-item {
        font-size: 10px;
    }

    #timer {
        font-size: 16px;
    }

    .menu-btn {
        padding: 10px 24px;
        font-size: 14px;
    }

    #menu-title {
        font-size: 26px;
    }

    #shop-inner {
        padding: 10px;
    }

    #reward-cards,
    #forge-cards,
    #artifact-cards {
        width: 100%;
    }

    .reward-card {
        height: 208px;
    }

    .reward-card-name,
    .forge-card-name {
        font-size: 13px;
    }

    .reward-card-desc,
    .forge-card-desc,
    .shop-item-desc {
        font-size: 10px;
    }
}
