/* --- 强制重置所有样式 --- */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
    background: url('../images/bj.jpg') no-repeat center center;
    background-size: cover;
    background-color: #1a0a1e;
    font-family: 'Microsoft YaHei', sans-serif;
    overflow: hidden;
    color: #fff;
    height: 100vh;
    width: 100vw;
    position: relative;
}

/* --- 信封层：使用绝对定位，不再使用 Flex --- */
.start-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.95); /* 黑色背景遮罩 */
    z-index: 9999;
    /* 关键修改：绝对定位居中，彻底抛弃 Flex */
    text-align: center;
    transition: opacity 0.8s;
}

/* 信封内容的垂直居中技巧 */
.envelope-container {
    position: relative;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    display: inline-block;
}

/* 信封本身样式 */
.envelope {
    width: 200px;
    height: 140px;
    background: #f0e0c0; /* 信封底色 */
    margin: 0 auto;
    position: relative;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(255,215,0,0.5);
    /* 这里只是简单的信封示意，你可以保留你原来的复杂信封样式 */
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    font-weight: bold;
    font-size: 18px;
    border: 2px solid #daa520;
}

/* --- 证书层：绝对独立的样式 --- */
.cert-box {
    display: none; /* 默认隐藏 */
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    /* 关键修改：使用 padding 实现居中，这在手机浏览器最稳 */
    padding-top: 25%;
    padding-left: 5%;
    padding-right: 5%;
    z-index: 9000;
    text-align: center;
    overflow-y: auto; /* 允许滚动 */
}

/* 证书内容卡片 */
.cert-content {
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    border-radius: 15px;
    padding: 30px 20px;
    margin: 0 auto;
    max-width: 400px;
    position: relative;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
    border: 5px solid #fff;
    outline: 2px dashed #daa520;
    outline-offset: -15px;
}

.cert-content h1 {
    color: #d6336c;
    font-size: 28px;
    margin-bottom: 20px;
    font-family: 'STXingkai', 'Xingkai SC', cursive;
}

.cert-text {
    font-size: 18px;
    margin: 12px 0;
    color: #555;
    font-weight: bold;
    text-align: left;
    padding-left: 10px;
    border-left: 4px solid #ffc107;
}

/* 按钮样式 */
.save-btn {
    margin-top: 25px;
    padding: 12px 30px;
    background: linear-gradient(to right, #ff758c, #ff7eb3);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(255, 117, 140, 0.4);
    cursor: pointer;
    animation: pulse 2s infinite;
}

/* 动画 */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* 打字机区域 */
.letter-box {
    display: none;
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 500px;
    background: rgba(0,0,0,0.8);
    padding: 30px;
    border-radius: 10px;
    text-align: left;
    font-size: 18px;
    line-height: 1.8;
    color: #fff;
    z-index: 9500;
    white-space: pre-wrap;
    font-family: 'Courier New', Courier, monospace;
    border: 1px solid #444;
}

.cursor {
    display: inline-block;
    width: 2px;
    background-color: #fff;
    animation: blink 1s infinite;
}

@keyframes blink { 50% { opacity: 0; } }

/* 底部按钮 */
.cert-button {
    display: none;
    position: fixed;
    bottom: 30px; left: 50%;
    transform: translateX(-50%);
    background: #ff4757;
    color: white;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(255, 71, 87, 0.4);
    z-index: 9800;
    animation: slideUp 0.8s ease-out;
    border: 2px solid #fff;
    cursor: pointer;
}

@keyframes slideUp {
    from { bottom: -100px; opacity: 0; }
    to { bottom: 30px; opacity: 1; }
}
