﻿/* alert_level.css - 完整样式文件
   要点：
   - overlay 居中，panel 居中且最大高度可滚动
   - header 固定（sticky），body 可滚动
   - 每个模块（描述/守关英雄/上阵英雄/关卡奖励）有标题与圆角背景
   - 图片父容器固定 50x50，图片本身 100% 填充并圆角，避免跑出父级
   - 徽章与数量显示在父级之上（absolute + z-index）
   - stats 行与 footer 固定显示
*/

:root {
    --panel-max-width: 820px;
    --panel-padding: 16px;
    --panel-bg-1: #2d2d2d;
    --panel-bg-2: #1f1a12;
    --muted-bg: rgba(255,255,255,0.02);
    --accent: #ffd79a;
    --danger: #ff5b5b;
}

/* 遮罩与居中 */
.level-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.80);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 98; /* 低于 plane (100) */
    transition: opacity .18s ease;
    opacity: 0;
    -webkit-tap-highlight-color: transparent;
}

    .level-overlay.level-overlay-show {
        display: flex;
        opacity: 1;
        max-width:600px;
    }

/* 面板 */
.level-panel {
    width: min(var(--panel-max-width), 92%);
    max-height: 90vh;
    background: linear-gradient(180deg, #8c4f4f, #6d5733);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    color: #f4e6d6;
    display: flex;
    flex-direction: column;
    padding-bottom: var(--panel-padding);
    box-sizing: border-box;
    position: relative;
    z-index: 99;
    margin: auto;
    overflow: hidden; /* 由内部 body 控制滚动 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* header 固定（sticky）*/
.level-header {
    padding: 6px 0;
    flex: 0 0 auto;
    position: sticky;
    top: 0;
    z-index: 12;
    
    box-sizing: border-box;
    border-radius: 8px;
}

.level-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
    text-align: center;
}

/* body（滚动区）*/
.level-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding: 6px 0;
    box-sizing: border-box;
}

/* 模块通用：圆角背景与标题 */
.level-section {
    background: var(--muted-bg);
    border-radius: 8px;
    padding: 8px;
    box-sizing: border-box;
    position: relative; /* 为徽章/数量的绝对定位提供参考 */
}

.section-title {
    font-size: 14px;
    color: #e6cfae;
    margin-bottom: 10px;
    font-weight: 600;
}

/* 描述（固定高度 150px，不滚动，超出隐藏）*/
.level-desc {
    font-size: 12px;
    color: #dcd6c7;
    height: 150px;
    overflow: hidden;
    padding: 6px;
    box-sizing: border-box;
    background: lch(0 0 0 / 0.1);
    border-radius: 5px;
}

/* 守关英雄：容器水平居中 */
.level-hero-area {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 0;
    justify-content: center;
    background: lch(0 0 0 / 0.1);
    border-radius: 5px;
}

/* 父级固定尺寸，图片占满父级 */
.level-hero-box {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.level-hero-img {
    display: block;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    object-fit: cover;
    margin: 0;
    border-radius: 6px;
    background: #d2b0b0;
}

/* 等级徽章（守关英雄） */
.level-hero-lv {
    position: absolute;
    right: 0px;
    bottom: 0px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 0px 6px;
    border-radius: 2px;
    font-size: 11px;
    z-index: 3;
    box-sizing: border-box;
}

/* 上阵槽位（父级固定 50x50，图片占满） */
.level-slot-area {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 0;
    justify-content: center;
    background: lch(0 0 0 / 0.1);
    border-radius: 5px;
}

.level-slot {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    background: rgba(255,255,255,0.04);
    border: 1px dashed rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    padding: 0;
    box-sizing: border-box;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 50px 50px;
}

    /* 加号图标样式（默认空槽） */
    .level-slot.btn-slot-add {
        background-image: url('/resource/image/test1/jia.png');
        background-position: center;
        background-repeat: no-repeat;
        background-size: 50px 50px;
    }

.slot-hero-img {
    display: block;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    object-fit: cover;
    margin: 0;
    border-radius: 8px;
    background: #d1eac4;
}

/* 已上阵徽章 */
.slot-hero-lv {
    position: absolute;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    color: #fff;
    padding: 0px 6px;
    border-radius: 2px;
    font-size: 11px;
    z-index: 3;
}

/* 奖励区域 */
.level-reward-area {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 6px 0;
    align-items: center;
    justify-content: center;
}

.level-reward-item {
    width: 50px;
    height: 50px;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.reward-icon {
    display: block;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    object-fit: cover;
    margin: 0;
    border-radius: 8px;
}

/* 奖励数量徽章层级 */
.reward-count {
    position: absolute;
    right: 0px;
    bottom: 0px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 0px 4px;
    border-radius: 4px;
    font-size: 11px;
    z-index: 3;
    box-sizing: border-box;
}

/* stats 行（图标 + 数值）*/
.level-stats-row {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: center;
    padding: 8px 0;
    flex: 0 0 auto;
}

.power-item {
    display: flex;
    gap: 8px;
    align-items: center;
    background: rgba(0,0,0,0.06);
    padding: 6px 10px;
    border-radius: 8px;
}

.power-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    display: block;
}

.power-value {
    color: var(--accent);
    font-weight: 700;
    font-size: 14px;
}

.min-power.warn {
    color: var(--danger);
}

/* footer */
.level-footer {
    display: flex;
    justify-content: center;
    padding-top: 8px;
    flex: 0 0 auto;
}

.level-start-btn {
    min-width: 140px;
    padding: 10px 16px;
    border: none;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

/* 确保 section 内元素不会意外定位到外层 */
.level-section,
.level-hero-area,
.level-slot-area,
.level-reward-area {
    position: relative;
}

/* 响应式 */
@media (max-width:420px) {
    .level-panel {
        max-height: 85%;
    }


    .level-desc {
        height: 120px;
    }
}
/* 在 alert_level.css 中新增，隐藏滚动条但保持可滚动 */
.level-body {
    -webkit-overflow-scrolling: touch; /* iOS 平滑滚动 */
    overflow-y: auto;
    overflow-x: hidden;
}

/* Firefox */
.level-body {
    scrollbar-width: none;
}

    /* Webkit / Chrome / Safari */
    .level-body::-webkit-scrollbar {
        width: 0;
        height: 0;
        display: none;
    }