/* =====================================================================
 * 碧柔 H5 - 整图背景 + 精确百分比定位的交互覆盖层
 * 设计稿尺寸：1200 × 2495（aspect-ratio 24/49.9 ≈ 0.481）
 * =================================================================== */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    color: #2a2a2a;
    -webkit-font-smoothing: antialiased;
    background: #f4ecff;
}

/* 整图容器：手机宽度满屏，居中，保留设计稿比例 */
.stage {
    position: relative;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    aspect-ratio: 1200 / 2495;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    overflow: hidden;
}

.stage-index  { background-image: url('/images/index.jpg');  }
.stage-info   { background-image: url('/images/info.jpg');   }
.stage-result { background-image: url('/images/result.jpg'); }
.stage-rule   { background-image: url('/images/rule.jpg');   aspect-ratio: 1200 / 7649; }
.stage-winner { background-image: url('/images/winner.jpg'); aspect-ratio: 1200 / 2500; }

/* 中签号码网格：覆盖在 winner 背景图的"纸卷"区域上 */
.winner-grid {
    position: absolute;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.4% 3%;
    align-content: start;
    z-index: 2;
}
.winner-cell {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(180deg, #e8f3ff 0%, #c9e0ff 100%);
    color: #2862b5;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 0 1px rgba(80, 140, 220, 0.35);
    overflow: hidden;
    white-space: nowrap;
}
.winner-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #6f7a99;
    font-size: 13px;
    padding: 10% 0;
}

/* 透明覆盖层（绝对定位，百分比对齐设计稿） */
.hit {
    position: absolute;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    margin: 0;
    font: inherit;
    color: transparent;          /* 不显示按钮自带文字 */
    appearance: none;
    -webkit-appearance: none;
}
.hit:active { background: rgba(255,255,255,0.08); }

/* 文件上传按钮（label 包裹隐藏 input） */
.upload-label {
    position: absolute;
    cursor: pointer;
    display: block;
}
.upload-label input[type="file"] { display: none; }

/* 已选图片预览（首图缩略 + 数量徽标） */
.preview-wrap {
    position: absolute;
    display: none;
}
.preview-wrap.show { display: block; }
.preview-thumb {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 4px 14px rgba(0,0,0,0.18);
    background: #fff;
    display: block;
}
/* 左上角：纯数字徽标（已选图片数量） */
.preview-count {
    position: absolute;
    top: 4px;
    left: 4px;
    min-width: 22px;
    height: 22px;
    line-height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    background: #e64a8a;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    z-index: 20;
    pointer-events: none;
    white-space: nowrap;
}
.preview-count.hidden { display: none; }

/* 右上角：删除按钮（清空全部已选图片） */
.preview-close {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    line-height: 20px;
    text-align: center;
    background: rgba(0,0,0,0.7);
    color: #fff;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    z-index: 20;
    user-select: none;
    -webkit-user-select: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.preview-close.hidden { display: none; }
.preview-close:active { background: rgba(0,0,0,0.9); transform: scale(0.92); }

/* 输入框：默认透明叠在画笔色块上；聚焦/有值时上浮并完整覆盖原条目 */
.field {
    position: absolute;
    background: transparent;
    border: none;
    outline: none;
    font-size: 15px;
    color: #4a4a4a;
    padding: 0 4%;
    line-height: 1.2;
    font-weight: 500;
    -webkit-appearance: none;
    appearance: none;
    text-align: left;
    z-index: 5;
    transition: transform 0.18s ease,
                background-color 0.18s ease,
                box-shadow 0.18s ease,
                border-radius 0.18s ease,
                height 0.18s ease;
}
.field::placeholder { color: transparent; }
.field:focus::placeholder { color: rgba(80,80,80,0.45); }

/* 聚焦或已有内容：底色取设计稿"画笔条目"的米白色，与背景融合 */
.field:focus,
.field:not(:placeholder-shown) {
    background: #F1EDE2;
    height: 3.2% !important;
    transform: translateY(-18%);
    box-shadow: 0 4px 12px rgba(60, 70, 130, 0.10),
                0 0 0 1px rgba(0, 0, 0, 0.04);
    border-radius: 8px;
    color: #2a2a2a;
    z-index: 8;
}

/* Toast & Loading */
.toast {
    position: fixed; left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.78);
    color: #fff;
    padding: 12px 22px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 999;
    max-width: 80%;
    text-align: center;
}
.toast.hidden { display: none; }

.loading-mask {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
}
.loading-mask.hidden { display: none; }
.loading-mask .box {
    background: #fff; padding: 22px 30px;
    border-radius: 12px; color: #333; font-size: 14px;
}

/* iOS Safari: 禁止背景图被默认放大 */
img { -webkit-user-drag: none; }
