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

html,
body {
    height: 100%;
    overflow: hidden;
    background: #070b13;
    font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: #e6f0ff;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent
}

canvas {
    display: block;
    position: fixed;
    inset: 0
}

/* ===================== HUD ===================== */
#hud {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    pointer-events: none;
    z-index: 10
}

.hud-box {
    background: rgba(10, 18, 32, .62);
    border: 1px solid rgba(90, 180, 255, .14);
    border-radius: 12px;
    padding: 8px 13px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px)
}

#hudLeft {
    flex: 0 0 auto;
    min-width: 158px;
    /* ★ 底色透明：只留字和进度条，不要那块半透明面板。
       文字直接压在星空上，所以补一层 text-shadow 保证可读。 */
    background: transparent;
    border: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .85)
}

#hudMid {
    flex: 0 0 auto;
    margin: 0 auto;
    font-variant-numeric: tabular-nums;
    font-size: 19px;
    font-weight: 700;
    color: #8ff0d0;
    letter-spacing: 1px
}

#hudRight {
    flex: 0 0 auto;
    text-align: right;
    font-size: 13px;
    color: #93a9c6;
    line-height: 1.5;
    /* ★ 同 #hudLeft：底色透明，只留文字 */
    background: transparent;
    border: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .85)
}

#hudRight b {
    color: #ffd166;
    font-size: 15px
}

.lvrow {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px
}

.lvbadge {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .5px;
    color: #0a1a2e;
    background: linear-gradient(135deg, #6ef0c8, #37c9ff);
    padding: 2px 9px;
    border-radius: 7px
}

#xpBar {
    height: 7px;
    border-radius: 99px;
    background: rgba(255, 255, 255, .09);
    overflow: hidden
}

#xpFill {
    height: 100%;
    width: 0%;
    border-radius: 99px;
    background: linear-gradient(90deg, #39e6b0, #3fc9ff);
    transition: width .12s linear
}

#hpWrap {
    position: fixed;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%);
    width: min(58vw, 460px);
    z-index: 10;
    pointer-events: none
}

#hpBar {
    height: 11px;
    border-radius: 99px;
    background: rgba(255, 255, 255, .09);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .08)
}

#hpFill {
    height: 100%;
    width: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, #ff4d6d, #ff9068);
    transition: width .12s linear
}

#hpNum {
    text-align: center;
    font-size: 11px;
    color: #89a0bd;
    margin-top: 5px;
    letter-spacing: 1px;
    font-variant-numeric: tabular-nums
}

/* ===================== BOSS 血条 ===================== */
#bossWrap {
    position: fixed;
    top: 74px;
    left: 50%;
    transform: translateX(-50%);
    width: min(74vw, 620px);
    z-index: 11;
    pointer-events: none;
    transition: opacity .25s
}

#bossWrap.hidden {
    display: none
}

.boss-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 5px;
    font-size: 12px;
    letter-spacing: 1px
}

#bossName {
    color: #e3c8ff;
    font-weight: 800;
    text-shadow: 0 0 14px rgba(180, 110, 255, .8)
}

#bossPhase {
    color: #a98fd0;
    font-variant-numeric: tabular-nums;
    white-space: nowrap
}

#bossBar {
    height: 12px;
    border-radius: 4px;
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(190, 130, 255, .35);
    overflow: hidden;
    box-shadow: 0 0 24px -6px rgba(160, 90, 255, .9)
}

#bossFill {
    height: 100%;
    width: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, #7b2ff7, #c77dff 55%, #ff8fd0);
    box-shadow: 0 0 14px rgba(200, 130, 255, .8);
    transition: width .12s linear
}

/* ===================== BOSS 来袭横幅 ===================== */
#bossBanner {
    position: fixed;
    top: 26%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 12;
    pointer-events: none;
    text-align: center;
    animation: bossBanner 2.4s ease-out forwards
}

#bossBanner.hidden {
    display: none
}

#bossBanner span {
    display: block;
    font-size: clamp(20px, 3.6vw, 34px);
    font-weight: 800;
    letter-spacing: 6px;
    color: #f0d9ff;
    text-shadow: 0 0 24px rgba(180, 90, 255, .95), 0 0 60px rgba(255, 90, 160, .6)
}

#bossBanner small {
    display: block;
    margin-top: 8px;
    font-size: 10.5px;
    letter-spacing: 2px;
    color: #a98fd0
}

@keyframes bossBanner {
    0% {
        opacity: 0;
        transform: translateX(-50%) scale(1.35)
    }

    14% {
        opacity: 1;
        transform: translateX(-50%) scale(1)
    }

    74% {
        opacity: 1
    }

    100% {
        opacity: 0;
        transform: translateX(-50%) scale(1.04)
    }
}

/* ===================== 静音按钮 ===================== */
#muteBtn {
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: 20;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(10, 18, 32, .68);
    border: 1px solid rgba(90, 180, 255, .18);
    color: #8fb8dd;
    font-size: 17px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color .14s, color .14s, transform .14s;
    line-height: 1
}

#muteBtn:hover {
    border-color: rgba(110, 255, 210, .6);
    color: #9dfde0
}

#muteBtn:active {
    transform: scale(.92)
}

#muteBtn.off {
    color: #4b5c72;
    border-color: rgba(90, 180, 255, .1)
}

/* ===================== 冲刺按钮 ===================== */
#dashBtn {
    position: fixed;
    right: 98px;
    bottom: 22px;
    z-index: 20;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(10, 18, 32, .82);
    border: 3px solid rgba(90, 180, 255, .22);
    color: #5c7089;
    font-size: 11.5px;
    font-weight: 800;
    font-family: inherit;
    letter-spacing: .5px;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: border-color .18s, color .18s, box-shadow .18s, transform .14s;
    -webkit-tap-highlight-color: transparent;
    user-select: none
}

#dashBtn:active {
    transform: scale(.92)
}

#dashBtn.ready {
    color: #04202e;
    border-color: rgba(143, 216, 255, .95);
    background: radial-gradient(circle at 50% 35%, #cdefff, #4fc3ff 75%);
    box-shadow: 0 0 30px -4px rgba(80, 200, 255, .95),
        0 0 12px -2px rgba(255, 255, 255, .6) inset;
    font-size: 14px
}

/* ===================== 大招按钮 ===================== */
#ultBtn {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 20;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: rgba(10, 18, 32, .82);
    border: 3px solid rgba(90, 180, 255, .22);
    color: #5c7089;
    font-size: 13px;
    font-weight: 800;
    font-family: inherit;
    letter-spacing: .5px;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color .18s, color .18s, box-shadow .18s, transform .14s;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
    user-select: none
}

#ultBtn:active {
    transform: scale(.92)
}

#ultBtn.ready {
    color: #04231b;
    border-color: rgba(110, 255, 210, .95);
    background: radial-gradient(circle at 50% 35%, #a8ffe4, #2fd8a8 75%);
    box-shadow: 0 0 34px -4px rgba(60, 255, 190, .95),
        0 0 12px -2px rgba(255, 255, 255, .6) inset;
    animation: ultPulse 1.35s ease-in-out infinite;
    font-size: 15px
}

@keyframes ultPulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 30px -6px rgba(60, 255, 190, .9)
    }

    50% {
        transform: scale(1.07);
        box-shadow: 0 0 46px -2px rgba(60, 255, 190, 1)
    }
}

/* ===================== 遮罩面板 ===================== */
.overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 26px;
    text-align: center;
    background: rgba(5, 9, 17, .86);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px)
}

.overlay.hidden {
    display: none
}

.overlay h1 {
    font-size: clamp(26px, 5vw, 44px);
    letter-spacing: 3px;
    font-weight: 800;
    background: linear-gradient(135deg, #8affd6, #4fc3ff 55%, #b98cff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent
}

.overlay p {
    font-size: 14px;
    line-height: 2;
    color: #8ba0bd;
    max-width: 460px
}

.overlay kbd {
    display: inline-block;
    padding: 1px 8px;
    margin: 0 2px;
    border-radius: 6px;
    background: rgba(120, 200, 255, .13);
    border: 1px solid rgba(120, 200, 255, .22);
    color: #bfe0ff;
    font-size: 12px;
    font-family: inherit
}

.btn {
    padding: 13px 42px;
    border: none;
    border-radius: 99px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 1px;
    cursor: pointer;
    color: #04231b;
    background: linear-gradient(135deg, #6dfcc4, #2fd8a8);
    box-shadow: 0 12px 34px -12px rgba(60, 255, 190, .95);
    transition: transform .14s, box-shadow .14s, border-color .14s, color .14s
}

.btn:hover {
    box-shadow: 0 16px 40px -10px rgba(60, 255, 190, 1)
}

.btn:active {
    transform: scale(.95)
}

.btn.ghost {
    background: transparent;
    border: 1px solid rgba(110, 200, 255, .35);
    color: #9dd8ff;
    box-shadow: none
}

.btn.ghost:hover {
    border-color: rgba(110, 255, 210, .7);
    color: #9dfde0;
    box-shadow: 0 0 26px -8px rgba(80, 255, 200, .7)
}

/* ★ 危险操作（立即结算）：默认只是低饱和的红边，不抢主按钮的注意力 */
.btn.ghost.danger {
    border-color: rgba(255, 120, 140, .38);
    color: #ff9aab
}

.btn.ghost.danger:hover {
    border-color: rgba(255, 90, 110, .85);
    color: #ffc2cd;
    box-shadow: 0 0 26px -8px rgba(255, 80, 110, .85)
}

/* ★ 确认态：整个按钮变红，和「继续战斗」形成明确对比 */
.btn.ghost.danger.confirming {
    background: linear-gradient(135deg, #ff6b8a, #d93a5c);
    border-color: transparent;
    color: #2a0410;
    box-shadow: 0 12px 32px -10px rgba(255, 80, 110, .95);
    animation: settlePulse 1s ease-in-out infinite
}

@keyframes settlePulse {

    0%,
    100% {
        transform: scale(1)
    }

    50% {
        transform: scale(1.05)
    }
}

.btn-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center
}

#settleHint {
    max-width: 320px
}

/* ★ 小号按钮（升级界面的「刷新卡片」） */
.btn.sm {
    padding: 9px 26px;
    font-size: 13px;
    letter-spacing: .5px
}

.btn:disabled {
    opacity: .38;
    cursor: default;
    box-shadow: none;
    transform: none
}

.btn.ghost:disabled:hover {
    border-color: rgba(110, 200, 255, .35);
    color: #9dd8ff;
    box-shadow: none
}

.dust-pill {
    font-size: 13px;
    color: #8ba0bd;
    padding: 6px 20px;
    border-radius: 99px;
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(120, 200, 255, .16);
    letter-spacing: .5px
}

.dust-pill b {
    color: #ffd166;
    font-size: 16px;
    font-variant-numeric: tabular-nums;
    margin-left: 4px
}

/* ===================== 难度选择 ===================== */
.diff-row {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    justify-content: center;
    margin: 2px 0 4px
}

.diff-btn {
    font: inherit;
    font-size: 12px;
    letter-spacing: .5px;
    padding: 7px 12px;
    border-radius: 9px;
    cursor: pointer;
    color: #8ba0bd;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(120, 200, 255, .16);
    transition: color .14s, border-color .14s, background .14s
}

.diff-btn:hover:not(.locked) {
    color: #cfe6ff;
    border-color: rgba(120, 200, 255, .38)
}

.diff-btn.on {
    color: #0b1420;
    font-weight: 700;
    background: linear-gradient(180deg, #9dfde0, #5ee7ff);
    border-color: transparent
}

.diff-btn.locked {
    cursor: not-allowed;
    opacity: .38
}

/* HUD 右上角的难度标记 */
.diff-tag {
    display: inline-block;
    margin-top: 3px;
    font-size: 11px;
    letter-spacing: .5px;
    color: #9dfde0;
    opacity: .75
}

/* 开始界面底部的版本号（用来确认线上跑的是哪一版）
   ★ 固定在最左下角、常驻显示：整局都能瞟一眼，
   位置避开左边的静音按钮（.muteBtn 在 left 16 / bottom 16，40px）。 */
.ver-tag {
    position: fixed;
    left: 64px;
    bottom: 21px;
    /* ★ 要比 .overlay（z-index 50）高，否则在开始/暂停界面会被遮罩盖住 —— 
       而它最需要被看到的地方正是开始界面。pointer-events:none 保证它永远不挡点击。 */
    z-index: 60;
    font-size: 11px;
    letter-spacing: 1px;
    color: #44586f;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
    user-select: none
}

/* ===================== 升级卡片 ===================== */
#cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 210px));
    gap: 16px;
    justify-content: center;
    justify-items: stretch;
    align-items: stretch;
    width: 100%;
    max-width: 1000px
}

.card {
    width: 100%;
    min-width: 0;
    padding: 24px 18px;
    border-radius: 18px;
    cursor: pointer;
    background: linear-gradient(160deg, rgba(40, 70, 110, .55), rgba(18, 28, 48, .72));
    border: 1px solid rgba(110, 200, 255, .2);
    color: #e6f0ff;
    font-family: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    transition: transform .16s, border-color .16s, box-shadow .16s
}

/* ★ 卡片多 / 屏幕窄时的紧凑样式 */
.card.compact {
    padding: 15px 9px;
    gap: 6px;
    border-radius: 14px
}

.card.compact .icon {
    font-size: 26px
}

.card.compact .name {
    font-size: 13.5px
}

.card.compact .desc {
    font-size: 11px;
    line-height: 1.45
}

.card:hover {
    transform: translateY(-7px);
    border-color: rgba(110, 255, 210, .65);
    box-shadow: 0 20px 44px -18px rgba(80, 255, 200, .8)
}

.card .icon {
    font-size: 36px;
    line-height: 1
}

.card .name {
    font-size: 16px;
    font-weight: 800;
    color: #9dfde0;
    letter-spacing: 1px
}

.card .desc {
    font-size: 12.5px;
    line-height: 1.6;
    color: #8ba0bd
}

/* ===================== 机库 ===================== */
#metaFilter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    max-width: 780px;
    width: 100%
}

.fbtn {
    padding: 6px 15px;
    border-radius: 99px;
    border: 1px solid rgba(120, 200, 255, .22);
    background: rgba(255, 255, 255, .04);
    color: #8ba0bd;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: .5px;
    cursor: pointer;
    transition: border-color .14s, color .14s, background .14s
}

.fbtn:hover {
    border-color: rgba(110, 255, 210, .6);
    color: #9dfde0
}

.fbtn.on {
    color: #04231b;
    border-color: transparent;
    background: linear-gradient(135deg, #6dfcc4, #2fd8a8)
}

#metaGrid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
    gap: 12px;
    max-width: 780px;
    width: 100%;
    max-height: 56vh;
    overflow-y: auto;
    padding: 4px
}

#metaGrid::-webkit-scrollbar {
    width: 7px
}

#metaGrid::-webkit-scrollbar-thumb {
    background: rgba(110, 200, 255, .22);
    border-radius: 99px
}

.meta-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 10px;
    border-radius: 14px;
    background: linear-gradient(160deg, rgba(40, 70, 110, .5), rgba(18, 28, 48, .7));
    border: 1px solid rgba(110, 200, 255, .2);
    color: #e6f0ff;
    font-family: inherit;
    cursor: pointer;
    transition: transform .14s, border-color .14s, box-shadow .14s
}

.meta-card:not(:disabled):hover {
    transform: translateY(-4px);
    border-color: rgba(110, 255, 210, .65);
    box-shadow: 0 14px 30px -14px rgba(80, 255, 200, .8)
}

.meta-card:disabled {
    cursor: default;
    opacity: .5
}

.meta-card.maxed {
    opacity: .85;
    border-color: rgba(255, 210, 100, .45);
    background: linear-gradient(160deg, rgba(90, 70, 30, .35), rgba(30, 24, 14, .6))
}

.m-icon {
    font-size: 26px;
    line-height: 1
}

.m-name {
    font-size: 13px;
    font-weight: 800;
    color: #9dfde0
}

.m-desc {
    font-size: 11px;
    color: #8ba0bd;
    text-align: center;
    line-height: 1.4
}

.m-pips {
    display: flex;
    gap: 3px;
    margin-top: 2px
}

.m-pips span {
    width: 9px;
    height: 5px;
    border-radius: 99px;
    background: rgba(255, 255, 255, .14)
}

.m-pips span.on {
    background: linear-gradient(90deg, #39e6b0, #3fc9ff)
}

.m-cost {
    font-size: 12px;
    font-weight: 700;
    color: #ffd166;
    font-variant-numeric: tabular-nums
}

.meta-card.maxed .m-cost {
    color: #ffb648
}

/* ===================== 结算数据 ===================== */
.stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 30px;
    margin: 4px 0
}

.stats div {
    display: flex;
    justify-content: space-between;
    gap: 22px;
    font-size: 13px;
    color: #8ba0bd
}

.stats b {
    color: #8ff0d0;
    font-size: 15px;
    font-variant-numeric: tabular-nums
}

.reward {
    font-size: 13px;
    color: #8ba0bd;
    letter-spacing: .5px;
    padding: 8px 22px;
    border-radius: 99px;
    background: rgba(255, 209, 102, .07);
    border: 1px solid rgba(255, 209, 102, .2)
}

.reward b {
    color: #ffd166;
    font-size: 17px;
    margin-left: 6px
}

#tip {
    position: fixed;
    bottom: 56px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11.5px;
    color: #4e6580;
    letter-spacing: .5px;
    z-index: 10;
    pointer-events: none
}

@media (max-width: 480px) {
    .card {
        padding: 14px 9px
    }

    .card .icon {
        font-size: 25px
    }

    .card .name {
        font-size: 13px
    }

    .card .desc {
        font-size: 10.5px;
        line-height: 1.4
    }

    .meta-card {
        padding: 11px 8px
    }

    #metaFilter {
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        max-height: 40px
    }

    .fbtn {
        flex: 0 0 auto;
        padding: 5px 12px;
        font-size: 11.5px
    }

    #tip {
        display: none
    }

    #bossWrap {
        top: 96px;
        width: 90vw
    }

    .boss-top {
        font-size: 10.5px;
        letter-spacing: .5px
    }

    #bossBanner span {
        letter-spacing: 3px
    }

    #ultBtn {
        width: 62px;
        height: 62px;
        font-size: 12px
    }

    #dashBtn {
        right: 86px;
        width: 50px;
        height: 50px;
        font-size: 10.5px
    }

    .btn.sm {
        padding: 8px 18px;
        font-size: 12px
    }
}
