/* 全局重置 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* 主体样式 */
body {
    font-family: 'PingFang SC', 'Helvetica Neue', 'Microsoft YaHei', sans-serif;
    font-weight: 300;
    background-color: #000000;
    color: #ffffff;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    line-height: 1.5;
}

/* 页面容器（预算页和商店页共用） */
.page {
    width: 100%;
    max-width: 1200px;
    background-color: #0a0a0a;
    border: 1px solid #00bfff;
    padding: 30px;
    display: none; /* 默认隐藏，由JS控制显示哪个页面 */
}

/* 预算页面 */
#budget-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

    #budget-page h1 {
        font-size: 2.5rem;
        margin-bottom: 2rem;
        font-weight: 300;
        color: #ffffff;
        border-bottom: 1px solid #00bfff;
        padding-bottom: 1rem;
    }

    #budget-page p {
        font-size: 1.2rem;
        margin-bottom: 1rem;
        color: #cccccc;
    }

    #budget-page input {
        width: 300px;
        padding: 12px;
        background: #111111;
        border: 1px solid #00bfff;
        color: white;
        font-size: 1.2rem;
        font-family: inherit;
        font-weight: 300;
        margin-bottom: 2rem;
        text-align: center;
    }

        #budget-page input:focus {
            outline: none;
            border-color: #66ccff;
            background: #1a1a1a;
        }

    #budget-page button {
        background: transparent;
        color: #00bfff;
        border: 1px solid #00bfff;
        padding: 12px 40px;
        font-size: 1.2rem;
        font-family: inherit;
        font-weight: 300;
        cursor: pointer;
        transition: 0.2s;
    }

        #budget-page button:hover {
            background: #00bfff;
            color: #000000;
        }

/* 商店页面（左右分栏） */
#shop-page {
    display: none; /* 初始隐藏 */
    flex-direction: row;
    gap: 30px;
}

.left-panel {
    flex: 1;
    border-right: 1px solid #333333;
    padding-right: 30px;
}

.right-panel {
    flex: 1;
}

/* 标题通用样式 */
h1, h2 {
    font-weight: 300;
    color: #ffffff;
    margin-bottom: 20px;
    letter-spacing: 1px;
}

h2 {
    border-left: 3px solid #00bfff;
    padding-left: 10px;
}

/* 按钮通用样式 */
button {
    background: transparent;
    color: #00bfff;
    border: 1px solid #00bfff;
    padding: 10px 20px;
    font-size: 16px;
    font-family: inherit;
    font-weight: 300;
    cursor: pointer;
    transition: 0.2s;
    margin: 5px 10px 5px 0;
    border-radius: 0;
}

    button:hover {
        background: #00bfff;
        color: #000000;
    }

/* 新开盒按钮特殊样式 */
#new-box-btn {
    border-color: #666666;
    color: #cccccc;
}

    #new-box-btn:hover {
        background: #666666;
        color: #ffffff;
    }

/* 预算显示区域 */
.budget-info {
    margin-top: 20px;
    font-size: 18px;
    border-top: 1px solid #333333;
    padding-top: 15px;
}

#budget-amount {
    color: #00bfff;
    font-weight: 400;
    margin-left: 5px;
}

/* 预算为负 */
.budget-negative {
    color: #ff6666 !important;
}

/* 背包容器（右侧） */
#drawn-container {
    background: #111111;
    border: 1px solid #333333;
    padding: 15px;
    min-height: 400px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-content: flex-start;
}

/* 背包卡片 */
.pass-card {
    background: #1a1a1a;
    border: 1px solid #00bfff;
    padding: 8px;
    width: calc(20% - 7px);
    text-align: center;
    font-size: 14px;
    color: #dddddd;
    transition: 0.1s;
}

    .pass-card:hover {
        border-color: #66ccff;
        color: #ffffff;
        background: #222222;
    }

/* 清空背包按钮 */
#clear-backpack-btn {
    border-color: #ff6666; /* 红色边框表示清空操作 */
    color: #ff6666;
    margin-bottom: 10px;
}

    #clear-backpack-btn:hover {
        background: #ff6666;
        color: black;
    }

/* 视图容器（选盒视图和抽盒视图） */
.view {
    width: 100%;
}

/* 网格布局（用于放置方块） */
.grid-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 20px 0;
}

/* 选盒界面的盒子方块 */
.box-tile {
    width: calc(30% - 7px);
    aspect-ratio: 1 / 1; /* 正方形 */
    background-color: #00bfff; /* 默认颜色，会被JS内联覆盖 */
    border: 2px solid #ffffff;
    border-radius: 8px;
    display: flex;
    align-items: flex-start; /* 文字左上角 */
    justify-content: flex-start;
    padding: 5px;
    color: white;
    font-weight: bold;
    text-shadow: 1px 1px 2px black;
    cursor: pointer;
    transition: 0.2s;
    box-sizing: border-box;
    font-size: 2.0rem; /* 固定字号 */
    line-height: 1; /* 防止多行文字撑高 */
    padding: 10px; /* 增加内边距让文字更靠边（左上角） */
    word-break: keep-all; /* 防止中文换行 */
}

    .box-tile:hover {
        transform: scale(1.05);
        border-color: #00bfff;
    }

/* 抽盒界面的小方块（常规14个） */
.item-tile {
    width: calc(50% - 5px); /* 一行2个 */
    aspect-ratio: 3 / 1; /* 长宽比3:1 */
    background-color: #00bfff; /* 实心状态颜色 */
    border: 2px solid #ffffff;
    border-radius: 4px;
    cursor: pointer;
    transition: 0.2s;
    position: relative;
}

    /* 已抽小方块：空心虚线 */
    .item-tile.drawn {
        background-color: transparent;
        border: 2px dashed #00bfff;
        opacity: 0.8;
    }

    /* 未抽方块悬停效果 */
    .item-tile:not(.drawn):hover {
        transform: scale(1.05);
        border-color: #ffd700;
    }

    /* 撕拉虚线装饰 */
    .item-tile::before {
        content: '';
        position: absolute;
        top: 2px;
        left: 2px;
        right: 2px;
        bottom: 2px;
        border: 1px dashed rgba(255,255,255,0.6);
        pointer-events: none;
        border-radius: 2px;
    }

    .item-tile::after {
        content: '';
        position: absolute;
        left: 2%;
        right: 2%;
        top: 0;
        height: 100%;
        background: repeating-linear-gradient( 
            to right, 
            transparent 0px, 
            transparent 2px,
            rgba(255,255,255,0.6) 2px, 
            rgba(255,255,255,0.6) 8px, 
            transparent 8px, 
            transparent 10px
          ) 0 40% / 100% 1.5px no-repeat,
                    repeating-linear-gradient(
            to right, 
            transparent 0px, 
            transparent 2px,
            rgba(255,255,255,0.6) 2px, 
            rgba(255,255,255,0.6) 8px, 
            transparent 8px,
            transparent 10px 
          ) 0 55% / 100% 1.5px no-repeat;
        pointer-events: none;
    }

/* 抽盒视图头部（返回按钮+盒名） */
.detail-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.back-btn {
    background: transparent;
    border: 1px solid #00bfff;
    color: #00bfff;
    font-size: 20px;
    padding: 5px 15px;
    cursor: pointer;
}

    .back-btn:hover {
        background: #00bfff;
        color: black;
    }

.detail-box-name {
    font-size: 1.2rem;
    color: #00bfff;
}

/* 预算警告文字 */
.warning-text {
    color: #ff6666;
    font-size: 14px;
    margin-top: 5px;
    min-height: 20px;
}

/* 抽盒视图按钮区域 */
.action-area {
    margin-top: 20px;
}

/* 不同尺寸屏幕适配 */
/* 平板 */
@media (max-width: 768px) {
    #shop-page {
        flex-direction: column; /* 左右变上下 */
    }

    .left-panel {
        border-right: none;
        border-bottom: 1px solid #333333;
        padding-right: 0;
        padding-bottom: 20px;
    }
    /* 选盒方块 */
    .box-tile {
        width: calc(33.33% - 7px);
        font-size: min(5vw, 2rem);
    }
    /* 抽盒小方块 */
    .item-tile {
        width: calc(50% - 5px);
        aspect-ratio: 3 / 1;
    }
    /* 背包卡片 */
    .pass-card {
        width: calc(33.33% - 6px);
    }

    h1 {
        font-size: 1.8rem;
    }
}

/* 手机 */
@media (max-width: 480px) {
    .box-tile {
        width: calc(33% - 7px);
    }

    .item-tile {
        width: calc(50% - 5px);
    }

    .pass-card {
        width: calc(50% - 5px);
    }
}