/* 小熊们的故事 - 交互式 H5 样式
   仿 Cocos Creator 风格 + 森林童话主题
   ============================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

/* --appvh 由 JS 按 window.innerHeight 实时写入（兼容微信 X5 老内核不支持 dvh 的情况），
   未写入时自动回退到 100dvh。旋转屏幕 / 地址栏收放时都会更新。 */
:root {
    --appvh: 100dvh;
}

html, body {
    width: 100%;
    height: 100%;
    height: var(--appvh, 100dvh);
    overflow: hidden;
    font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #1a2332;
    color: #fff;
    user-select: none;
    -webkit-user-select: none;
}

/* ===== 通用场景容器 ===== */
.scene {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: var(--appvh, 100dvh);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

.scene.active {
    opacity: 1;
    visibility: visible;
}

/* ====== 引导图场景（登录页之前 hb01→hb02→hb03） ====== */
.scene-intro {
    background: #1a2332;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
}

.scene-intro #intro-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    pointer-events: none; /* 点击统一由场景容器处理，防拖拽/长按保存 */
}

/* 点击提示：延迟 2 秒淡入（与 JS 防误触最短阅读时间一致），呼吸动画引导点击 */
.scene-intro .intro-hint {
    position: absolute;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 26px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 15px;
    letter-spacing: 2px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s ease, visibility 0.8s ease;
    white-space: nowrap;
    pointer-events: none; /* 提示本身不响应点击，防止点提示文字误触 */
}

.scene-intro .intro-hint.show {
    opacity: 1;
    visibility: visible;
    animation: introHintBreath 2.2s ease-in-out infinite;
}

/* 倒计时状态：胶囊立即可见（半透明、无呼吸），显示 2 → 1 大号数字 */
.scene-intro .intro-hint.counting {
    opacity: 0.55;
    visibility: visible;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0;
    padding: 6px 20px;
    transition: none;
}

@keyframes introHintBreath {
    0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.65; }
    50% { transform: translateX(-50%) scale(1.06); opacity: 1; }
}

@media (max-width: 480px) {
    .scene-intro .intro-hint {
        font-size: 13px;
        padding: 8px 20px;
        bottom: 20px;
    }
}

/* ====== 登录注册场景 ====== */
.scene-auth {
    background: linear-gradient(180deg, #1a2332 0%, #2d3a4f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.scene-auth .auth-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background-image: url('../images/scenes/opening_forest.jpg');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    opacity: 0.3;
}

.scene-auth .auth-card {
    position: relative;
    z-index: 2;
    background: rgba(255, 255, 255, 0.97);
    border-radius: 32px;
    padding: 48px 36px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: cardEnter 0.6s ease-out;
}

.scene-auth .auth-logo {
    font-size: 72px;
    text-align: center;
    margin-bottom: 16px;
}

.scene-auth .auth-title {
    text-align: center;
    font-size: 28px;
    font-weight: 800;
    color: #5D4037;
    margin-bottom: 8px;
}

.scene-auth .auth-subtitle {
    text-align: center;
    font-size: 14px;
    color: #888;
    margin-bottom: 32px;
}

.scene-auth .auth-form {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.scene-auth .input-group {
    margin-bottom: 20px;
}

.scene-auth .input-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #5D4037;
    margin-bottom: 8px;
}

.scene-auth .input-group input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 16px;
    color: #333;
    transition: border-color 0.3s, box-shadow 0.3s;
    background: #fff;
}

.scene-auth .input-group input:focus {
    outline: none;
    border-color: #7ED957;
    box-shadow: 0 0 0 3px rgba(126, 217, 87, 0.2);
}

.scene-auth .input-group input::placeholder {
    color: #bbb;
}

.scene-auth .error-msg {
    color: #FF6B6B;
    font-size: 13px;
    text-align: center;
    margin-bottom: 16px;
    min-height: 20px;
    display: none;
}

.scene-auth .auth-btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    letter-spacing: 4px;
}

.scene-auth .auth-btn:active {
    transform: scale(0.97);
}

.scene-auth .auth-btn.primary {
    background: linear-gradient(180deg, #7ED957 0%, #4CAF50 100%);
    color: #fff;
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4),
                inset 0 -3px 0 rgba(0, 0, 0, 0.15);
}

.scene-auth .auth-btn.primary:active {
    box-shadow: 0 3px 10px rgba(76, 175, 80, 0.3),
                inset 0 -2px 0 rgba(0, 0, 0, 0.15);
}

.scene-auth .auth-switch {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: #888;
}

.scene-auth .auth-switch a {
    color: #4CAF50;
    text-decoration: none;
    font-weight: 600;
}

.scene-auth .auth-switch a:hover {
    text-decoration: underline;
}

/* ====== 首次登录信息补全场景 ====== */
.scene-profile {
    background: linear-gradient(180deg, #1a2332 0%, #2d3a4f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.scene-profile .profile-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background-image: url('../images/scenes/opening_forest.jpg');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    opacity: 0.3;
}

.scene-profile .profile-card {
    position: relative;
    z-index: 2;
    background: rgba(255, 255, 255, 0.97);
    border-radius: 32px;
    padding: 40px 32px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: cardEnter 0.6s ease-out;
}

.scene-profile .profile-logo {
    font-size: 56px;
    text-align: center;
    margin-bottom: 12px;
    animation: bounce 1.6s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.scene-profile .profile-title {
    text-align: center;
    font-size: 24px;
    font-weight: 800;
    color: #5D4037;
    margin-bottom: 8px;
}

.scene-profile .profile-subtitle {
    text-align: center;
    font-size: 13px;
    color: #888;
    margin-bottom: 28px;
    line-height: 1.5;
}

.scene-profile .input-group {
    margin-bottom: 18px;
    text-align: left;
}

.scene-profile .input-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #5D4037;
    margin-bottom: 8px;
    padding-left: 4px;
}

.scene-profile .input-group select {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 16px;
    color: #333;
    background: #fff
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%235D4037' d='M6 8L0 0h12z'/></svg>")
        no-repeat right 16px center;
    background-size: 12px 8px;
    transition: border-color 0.3s, box-shadow 0.3s;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
}

.scene-profile .input-group select:focus {
    outline: none;
    border-color: #7ED957;
    box-shadow: 0 0 0 3px rgba(126, 217, 87, 0.2);
}

.scene-profile .error-msg {
    color: #FF6B6B;
    font-size: 13px;
    text-align: center;
    margin-bottom: 16px;
    min-height: 20px;
    display: none;
}

.scene-profile .auth-btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 50px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
    letter-spacing: 3px;
    margin-top: 8px;
}

.scene-profile .auth-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.scene-profile .auth-btn.primary {
    background: linear-gradient(180deg, #7ED957 0%, #4CAF50 100%);
    color: #fff;
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4),
                inset 0 -3px 0 rgba(0, 0, 0, 0.15);
}

.scene-profile .auth-btn.primary:active:not(:disabled) {
    transform: scale(0.97);
}

.scene-profile .auth-switch {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: #888;
}

.scene-profile .auth-switch a {
    color: #4CAF50;
    text-decoration: none;
    font-weight: 600;
}

.scene-profile .auth-switch a:hover {
    text-decoration: underline;
}

@keyframes cardEnter {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ====== 监护告知场景 ====== */
.scene-guardian {
    background: linear-gradient(180deg, #1a2332 0%, #2d3a4f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.scene-guardian .guardian-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background-image: url('../images/scenes/opening_forest.jpg');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    opacity: 0.3;
}

.scene-guardian .guardian-card {
    position: relative;
    z-index: 2;
    background: rgba(255, 255, 255, 0.97);
    border-radius: 24px;
    width: 92%;
    max-width: 560px;
    max-height: 88vh;
    max-height: 88dvh;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: cardEnter 0.6s ease-out;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.scene-guardian .guardian-header {
    text-align: center;
    padding: 28px 32px 16px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.scene-guardian .guardian-icon {
    font-size: 40px;
    margin-bottom: 8px;
}

.scene-guardian .guardian-title {
    font-size: 22px;
    font-weight: 800;
    color: #5D4037;
    line-height: 1.4;
}

.scene-guardian .guardian-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 32px;
    -webkit-overflow-scrolling: touch;
}

.scene-guardian .guardian-greeting {
    font-size: 15px;
    color: #5D4037;
    font-weight: 600;
    margin-bottom: 8px;
}

.scene-guardian .guardian-intro {
    font-size: 14px;
    color: #666;
    line-height: 1.7;
    margin-bottom: 18px;
    text-indent: 2em;
}

.scene-guardian .guardian-section-title {
    font-size: 15px;
    font-weight: 700;
    color: #4CAF50;
    margin: 18px 0 10px;
    padding-left: 8px;
    border-left: 3px solid #7ED957;
}

.scene-guardian .guardian-list {
    list-style: none;
    counter-reset: guardian-counter;
    padding: 0;
}

.scene-guardian .guardian-list li {
    position: relative;
    padding-left: 28px;
    margin-bottom: 10px;
    font-size: 14px;
    color: #555;
    line-height: 1.7;
    counter-increment: guardian-counter;
}

.scene-guardian .guardian-list li::before {
    content: counter(guardian-counter);
    position: absolute;
    left: 0;
    top: 2px;
    width: 18px;
    height: 18px;
    background: #7ED957;
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.scene-guardian .guardian-list li strong {
    color: #5D4037;
    font-weight: 700;
}

.scene-guardian .guardian-warning {
    background: #FFF8E1;
    border-radius: 12px;
    padding: 14px 16px;
    margin: 12px 0;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    border-left: 4px solid #FF9800;
}

.scene-guardian .guardian-warning-icon {
    font-size: 18px;
    flex-shrink: 0;
    line-height: 1.6;
}

.scene-guardian .guardian-warning span:last-child {
    font-size: 14px;
    color: #5D4037;
    line-height: 1.6;
}

.scene-guardian .guardian-footer {
    padding: 16px 32px 24px;
    border-top: 1px solid #eee;
    flex-shrink: 0;
    background: #fafafa;
}

.scene-guardian .guardian-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
    cursor: pointer;
}

.scene-guardian .guardian-check input[type="checkbox"] {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 2px;
    cursor: pointer;
    accent-color: #4CAF50;
}

.scene-guardian .guardian-check-text {
    font-size: 13px;
    color: #5D4037;
    line-height: 1.6;
    user-select: none;
    -webkit-user-select: none;
}

.scene-guardian .auth-btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.3s;
    letter-spacing: 2px;
}

.scene-guardian .auth-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: #ccc;
    color: #888;
    box-shadow: none;
}

.scene-guardian .auth-btn.primary:not(:disabled) {
    background: linear-gradient(180deg, #7ED957 0%, #4CAF50 100%);
    color: #fff;
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4),
                inset 0 -3px 0 rgba(0, 0, 0, 0.15);
}

.scene-guardian .auth-btn.primary:not(:disabled):active {
    transform: scale(0.97);
}

/* 滚动条样式 */
.scene-guardian .guardian-content::-webkit-scrollbar {
    width: 6px;
}
.scene-guardian .guardian-content::-webkit-scrollbar-thumb {
    background: rgba(93, 64, 55, 0.2);
    border-radius: 3px;
}
.scene-guardian .guardian-content::-webkit-scrollbar-track {
    background: transparent;
}

/* ====== 开场场景 (森林背景) ====== */
.scene-opening {
    background: #1a2332;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.scene-opening .bg-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background-image: url('../images/scenes/opening_forest.jpg');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    z-index: 1;
}

.scene-opening .bg-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: linear-gradient(180deg,
        rgba(0,0,0,0.0) 0%,
        rgba(0,0,0,0.1) 40%,
        rgba(0,0,0,0.4) 100%);
    z-index: 2;
}

.scene-opening .title {
    position: relative;
    z-index: 3;
    font-size: 64px;
    font-weight: 800;
    color: #FFE066;
    text-shadow: 0 4px 20px rgba(0,0,0,0.6),
                 0 0 30px rgba(255, 224, 102, 0.3);
    margin-bottom: 20px;
    letter-spacing: 8px;
    text-align: center;
    animation: titleFloat 3s ease-in-out infinite;
}

.scene-opening .subtitle {
    position: relative;
    z-index: 3;
    font-size: 22px;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.7);
    margin-bottom: 80px;
    letter-spacing: 4px;
}

.scene-opening .start-btn {
    position: relative;
    z-index: 3;
    padding: 22px 90px;
    background: linear-gradient(180deg, #7ED957 0%, #4CAF50 100%);
    color: #fff;
    font-size: 32px;
    font-weight: 700;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(76, 175, 80, 0.4),
                inset 0 -4px 0 rgba(0,0,0,0.15),
                inset 0 4px 0 rgba(255,255,255,0.25);
    letter-spacing: 12px;
    text-indent: 12px;
    animation: btnPulse 1.8s ease-in-out infinite;
    transition: transform 0.2s;
}

.scene-opening .start-btn:active {
    transform: scale(0.95);
}

.scene-opening .bottom-tip {
    position: absolute;
    bottom: 30px;
    left: 0;
    right: 0;
    z-index: 3;
    text-align: center;
    font-size: 14px;
    color: rgba(255,255,255,0.5);
    letter-spacing: 2px;
}

/* ====== 中转页（老用户登录后） ====== */
.scene-hub {
    background: #1a2332;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.scene-hub .bg-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background-image: url('../images/scenes/opening_forest.jpg');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    z-index: 1;
}
.scene-hub .bg-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: linear-gradient(180deg, rgba(0,0,0,0.0) 0%, rgba(0,0,0,0.1) 40%, rgba(0,0,0,0.4) 100%);
    z-index: 2;
}
.scene-hub .user-info {
    position: absolute;
    top: 16px;
    right: 20px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    font-size: 14px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.scene-hub .hub-card {
    position: relative;
    z-index: 3;
    text-align: center;
}
.scene-hub .hub-logo {
    font-size: 72px;
    margin-bottom: 10px;
    animation: titleFloat 3s ease-in-out infinite;
}
.scene-hub .hub-title {
    font-size: 48px;
    font-weight: 800;
    color: #FFE066;
    text-shadow: 0 4px 20px rgba(0,0,0,0.6), 0 0 30px rgba(255,224,102,0.3);
    margin-bottom: 10px;
    letter-spacing: 6px;
}
.scene-hub .hub-subtitle {
    font-size: 18px;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.7);
    margin-bottom: 50px;
    letter-spacing: 3px;
}
.scene-hub .hub-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}
.scene-hub .hub-btn {
    padding: 18px 60px;
    font-size: 24px;
    font-weight: 700;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    letter-spacing: 4px;
    transition: transform 0.2s;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3), inset 0 -4px 0 rgba(0,0,0,0.15), inset 0 4px 0 rgba(255,255,255,0.25);
}
.scene-hub .hub-btn:active { transform: scale(0.95); }
.scene-hub .hub-btn-history {
    background: linear-gradient(180deg, #42A5F5 0%, #1976D2 100%);
    color: #fff;
}
.scene-hub .hub-btn-start {
    background: linear-gradient(180deg, #7ED957 0%, #4CAF50 100%);
    color: #fff;
    animation: btnPulse 1.8s ease-in-out infinite;
}
/* 历史报告面板 */
.scene-hub .hub-history-panel {
    position: relative;
    z-index: 5;
    width: 90%;
    max-width: 500px;
    max-height: 70vh;
    overflow-y: auto;
    background: rgba(255,255,255,0.96);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.scene-hub .hub-history-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.scene-hub .hub-back-btn {
    padding: 6px 16px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 20px;
    background: #f5f5f5;
    cursor: pointer;
    color: #333;
}
.scene-hub .hub-history-title {
    font-size: 20px;
    font-weight: 700;
    color: #333;
}
.scene-hub .hub-history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.scene-hub .hub-history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #f9f9f9;
    border-radius: 10px;
    border: 1px solid #eee;
}
.scene-hub .hub-history-date {
    flex: 1;
    font-size: 14px;
    color: #666;
}
.scene-hub .hub-history-score {
    font-size: 15px;
    color: #333;
}
.scene-hub .hub-history-level {
    padding: 4px 12px;
    border-radius: 12px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
}
.scene-hub .hub-history-loading,
.scene-hub .hub-history-empty,
.scene-hub .hub-history-error {
    text-align: center;
    padding: 30px;
    color: #999;
    font-size: 15px;
}

/* 用户信息显示 */
.scene-opening .user-info {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 12px;
}

.scene-opening .user-info span {
    background: rgba(255, 255, 255, 0.9);
    color: #5D4037;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.scene-opening .logout-btn {
    background: rgba(255, 107, 107, 0.9);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
}

.scene-opening .logout-btn:hover {
    background: #FF6B6B;
}

.scene-opening .logout-btn:active {
    transform: scale(0.95);
}

@keyframes titleFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes btnPulse {
    0%, 100% { box-shadow: 0 8px 24px rgba(76, 175, 80, 0.4), inset 0 -4px 0 rgba(0,0,0,0.15), inset 0 4px 0 rgba(255,255,255,0.25); }
    50% { box-shadow: 0 8px 32px rgba(76, 175, 80, 0.7), inset 0 -4px 0 rgba(0,0,0,0.15), inset 0 4px 0 rgba(255,255,255,0.25); }
}

/* ====== 题目场景 ====== */
.scene-question {
    background: #87CEEB;
}

/* ===== 题间柔和过渡层（切题防蓝屏兜底）===== */
.question-transition {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    z-index: 50;                /* 盖住视频/帧图/选项/顶栏，低于星星特效 */
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #FFF8E1 0%, #FFE0B2 100%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;       /* 不拦截任何点击（纯视觉层） */
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.question-transition.show {
    opacity: 1;
    visibility: visible;
}

.question-transition .qt-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.question-transition .qt-bear {
    font-size: 52px;
    animation: qtBounce 0.9s ease-in-out infinite;
}

.question-transition .qt-text {
    font-size: 16px;
    color: #8D6E63;
    letter-spacing: 1px;
}

@keyframes qtBounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50%      { transform: translateY(-10px) scale(1.06); }
}

/* ====== 视频播放器 ====== */
.story-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    object-fit: contain;
    background: #000;
    z-index: 1;
    display: none;
}

.story-video.playing {
    display: block;
}

/* 开场场景视频在背景图上方、文字下方 */
#opening-video {
    z-index: 1;
}

/* 题目场景视频在背景图上方，选项卡片下方 */
#question-video {
    z-index: 1;
}

/* 题目场景静态图片（视频最后一帧，含三只小熊） */
#question-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    object-fit: contain;
    background: #000;
    z-index: 1;
    display: none;
}

#question-img.show {
    display: block;
}

/* 结尾视频在结果卡片下方 */
#ending-video {
    z-index: 0;
}

.scene-question .scene-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

.scene-question .scene-bg::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: linear-gradient(180deg,
        rgba(0,0,0,0.15) 0%,
        rgba(0,0,0,0) 30%,
        rgba(0,0,0,0) 70%,
        rgba(0,0,0,0.25) 100%);
}

/* 顶部进度条 */
.scene-question .progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 8px;
    background: rgba(0,0,0,0.2);
    z-index: 10;
}

.scene-question .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #7ED957, #4CAF50);
    box-shadow: 0 0 12px rgba(126, 217, 87, 0.5);
    transition: width 0.5s ease;
}

/* 顶部导航栏 */
.scene-question .top-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    z-index: 11;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
}

.scene-question .progress-text {
    background: rgba(0,0,0,0.45);
    color: #fff;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    backdrop-filter: blur(8px);
}

.scene-question .back-btn {
    background: rgba(0,0,0,0.45);
    color: #fff;
    border: none;
    padding: 0 18px;
    height: 40px;
    min-width: 40px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1px;
    line-height: 1;
    cursor: pointer;
    backdrop-filter: blur(8px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    transition: transform 0.2s, background 0.2s;
}

/* 与 back-btn 等宽的隐形占位,保持顶部进度文字居中 */
.scene-question .back-btn-spacer {
    visibility: hidden;
    padding: 0 18px;
    height: 40px;
    min-width: 40px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1px;
    line-height: 1;
    white-space: nowrap;
}

.scene-question .back-btn:active {
    transform: scale(0.9);
    background: rgba(0,0,0,0.6);
}

/* 题目文字 */
.scene-question .question-panel {
    position: absolute;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 600px;
    z-index: 10;
    text-align: center;
}

.scene-question .question-text {
    display: inline-block;
    background: rgba(255,255,255,0.95);
    color: #5D4037;
    padding: 18px 28px;
    border-radius: 30px;
    font-size: 22px;
    font-weight: 700;
    box-shadow: 0 6px 20px rgba(0,0,0,0.25),
                inset 0 -3px 0 rgba(0,0,0,0.08);
    border: 3px solid #fff;
    line-height: 1.4;
    animation: questionEnter 0.5s ease-out;
}

@keyframes questionEnter {
    0% { opacity: 0; transform: translateY(-30px) scale(0.85); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* 选项小熊点击区域 - 透明覆盖在视频实际渲染区域上 */
.scene-question .options-container {
    position: absolute;
    z-index: 10;
    pointer-events: none;
    /* width/height/left/top 由 JS 根据视频 object-fit:contain 实际渲染区域动态计算 */
    /* 注意：不再使用 flex，每个 .bear-zone 由 JS 绝对定位到对应白边框内 */
}

/* 三个透明点击区域，分别覆盖左/中/右小熊白边选择框 */
.scene-question .bear-zone {
    position: absolute;          /* 由 JS 设置 left/top/width/height 精确对齐白边框 */
    cursor: pointer;
    pointer-events: auto;
    transition: background 0.2s ease, box-shadow 0.2s ease, opacity 0.4s ease-in;
    border-radius: 20px;         /* 与最后一帧白色圆角边框圆角一致 */
}

/* hover 无视觉反馈，让用户无感 */
.scene-question .bear-zone:hover {
    background: transparent;
    box-shadow: none;
}

/* 选中反馈 - 白色光晕闪烁 */
.scene-question .bear-zone.selected {
    animation: zoneGlow 0.5s ease-out forwards;
}

@keyframes zoneGlow {
    0% { background: transparent; }
    30% { background: rgba(255, 255, 255, 0.25); }
    100% { background: rgba(255, 255, 255, 0.08); }
}

/* 入场动画 - 即时可见（轮询已保证视频末尾即可点，无需淡入延迟） */
.scene-question .bear-zone:nth-child(1) { animation: zoneFadeIn 0.15s 0s both; }
.scene-question .bear-zone:nth-child(2) { animation: zoneFadeIn 0.15s 0s both; }
.scene-question .bear-zone:nth-child(3) { animation: zoneFadeIn 0.15s 0s both; }

@keyframes zoneFadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* 飞出动画 - 选中后淡出 */
.scene-question .options-container.flying .bear-zone.selected {
    opacity: 0;
    transition: opacity 0.4s ease-in;
}
.scene-question .options-container.flying .bear-zone:not(.selected) {
    opacity: 0;
    transition: opacity 0.4s ease-in;
}

/* 提示文字 */
.scene-question .hint-text {
    position: absolute;
    bottom: 50px;
    left: 0;
    right: 0;
    z-index: 10;
    text-align: center;
    color: #fff;
    font-size: 16px;
    text-shadow: 0 2px 6px rgba(0,0,0,0.6);
    letter-spacing: 1px;
    animation: hintBlink 2s ease-in-out infinite;
}

@keyframes hintBlink {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* 答对/答错飞行动画提示 - 一闪而过的星星 */
.star-burst {
    position: absolute;
    pointer-events: none;
    z-index: 100;
}

.star-burst .star {
    position: absolute;
    font-size: 28px;
    color: #FFE066;
    animation: starFly 0.8s ease-out forwards;
}

@keyframes starFly {
    0% { transform: translate(0, 0) scale(0) rotate(0deg); opacity: 0; }
    20% { transform: translate(var(--dx), var(--dy)) scale(1.2) rotate(60deg); opacity: 1; }
    100% { transform: translate(calc(var(--dx) * 2), calc(var(--dy) * 2 + 60px)) scale(0.3) rotate(180deg); opacity: 0; }
}

/* ====== 过渡场景 ====== */
.scene-transition {
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.scene-transition .loader {
    width: 80px;
    height: 80px;
    border: 6px solid #f0f0f0;
    border-top-color: #7ED957;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.scene-transition .tip {
    margin-top: 30px;
    font-size: 20px;
    color: #5D4037;
    font-weight: 600;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ====== 结果场景 ====== */
.scene-result {
    background: #1a2332;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 40px 20px;
    overflow-y: auto;
}

.scene-result .result-card {
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(255,255,255,0.95));
    color: #5D4037;
    border-radius: 32px;
    padding: 40px 32px;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    text-align: center;
    z-index: 2;
    position: relative;
    animation: cardEnter 0.8s ease-out;
    margin: auto 0;
}

@keyframes cardEnter {
    0% { opacity: 0; transform: translateY(50px) scale(0.8); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* 机构 logo（报告页顶部） */
.scene-result .result-logo {
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid #eee;
}
.scene-result .result-logo img {
    max-height: 60px;
    max-width: 80%;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.scene-result .result-emoji {
    font-size: 100px;
    margin-bottom: 16px;
    animation: emojiPop 0.8s ease-out 0.3s both;
}

@keyframes emojiPop {
    0% { transform: scale(0) rotate(-180deg); }
    60% { transform: scale(1.2) rotate(20deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.scene-result .result-score {
    font-size: 28px;
    font-weight: 800;
    color: #5D4037;
    margin-bottom: 8px;
}

.scene-result .result-score .num {
    display: inline-block;
    font-size: 48px;
    font-weight: 800;
    line-height: 1.2;
    color: var(--level-color, #FF6B6B);
}

.scene-result .result-level {
    display: inline-block;
    padding: 10px 28px;
    border-radius: 30px;
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 24px;
    background: var(--level-color, #FF6B6B);
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.scene-result .result-desc {
    font-size: 18px;
    line-height: 1.6;
    color: #5D4037;
    margin-bottom: 16px;
    font-weight: 600;
}

/* ====== 九维雷达图 ====== */
.scene-result .result-radar {
    margin: 6px 0 22px;
    padding: 18px 12px 14px;
    background: #FAF7F3;
    border-radius: 20px;
}

.scene-result .radar-title {
    font-size: 16px;
    font-weight: 600;
    color: #5D4037;
    margin-bottom: 6px;
}

.scene-result .radar-svg {
    width: 100%;
    max-width: 340px;
    height: auto;
    display: block;
    margin: 0 auto;
}

.scene-result .radar-svg .radar-label {
    font-size: 12px;
    fill: #5D4037;
    font-weight: 400;
}

.scene-result .radar-svg .radar-value {
    font-size: 12px;
    letter-spacing: 0.5px;
}

.scene-result .radar-note {
    font-size: 11px;
    color: #9C8E84;
    margin-top: 6px;
    line-height: 1.5;
}

@media (max-width: 480px) {
    .scene-result .radar-svg .radar-label { font-size: 11px; }
    .scene-result .radar-note { font-size: 10px; }
}

.scene-result .result-advice {
    background: #FFF8E1;
    border-radius: 16px;
    padding: 16px 20px;
    font-size: 15px;
    line-height: 1.6;
    color: #5D4037;
    text-align: left;
    border-left: 4px solid var(--level-color, #FF6B6B);
    margin-bottom: 24px;
}

.scene-result .result-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

/* ====== 异常结果：需要专家咨询 ====== */
.scene-result .consult-banner {
    background: linear-gradient(135deg, #FFE0E0 0%, #FFC1C1 100%);
    border-radius: 18px;
    padding: 22px 20px 18px;
    margin: 8px 0 18px;
    text-align: center;
    box-shadow: 0 6px 18px rgba(255, 107, 107, 0.25);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 6px 18px rgba(255, 107, 107, 0.25); }
    50%      { transform: scale(1.02); box-shadow: 0 8px 22px rgba(255, 107, 107, 0.4); }
}

.scene-result .consult-icon {
    font-size: 44px;
    line-height: 1;
    margin-bottom: 8px;
}

.scene-result .consult-title {
    font-size: 22px;
    font-weight: 800;
    color: #C62828;
    letter-spacing: 2px;
    margin-bottom: 4px;
}

.scene-result .consult-subtitle {
    font-size: 12px;
    color: #B71C1C;
    opacity: 0.85;
}

.scene-result .consult-tip {
    background: #FFF3E0;
    border-left: 4px solid #FF8C42;
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 14px;
    line-height: 1.7;
    color: #5D4037;
    text-align: left;
    margin-bottom: 16px;
}

.scene-result .consult-list {
    background: #F3F8FF;
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 22px;
    text-align: left;
}

.scene-result .consult-item {
    font-size: 14px;
    line-height: 1.6;
    color: #5D4037;
    padding: 6px 0;
    border-bottom: 1px dashed rgba(0, 0, 0, 0.08);
}

.scene-result .consult-item:last-child {
    border-bottom: none;
}

.scene-result .consult-item b {
    color: #C62828;
}

.scene-result .action-btn {
    padding: 16px 24px;
    border: none;
    border-radius: 50px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15),
                inset 0 -3px 0 rgba(0,0,0,0.1);
}

.scene-result .action-btn:active {
    transform: scale(0.96);
}

.scene-result .action-btn.primary {
    background: linear-gradient(180deg, #7ED957 0%, #4CAF50 100%);
}

.scene-result .action-btn.secondary {
    background: linear-gradient(180deg, #74b9ff 0%, #0984e3 100%);
}

.scene-result .action-btn.ghost {
    background: linear-gradient(180deg, #dfe6e9 0%, #b2bec3 100%);
    color: #5D4037;
}

/* 分数进度条 */
.scene-result .score-bar {
    display: flex;
    gap: 4px;
    margin: 20px 0;
    width: 100%;
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
}

.scene-result .score-bar .bar-seg {
    flex: 1;
    background: rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
}

.scene-result .score-bar .bar-seg.filled {
    background: var(--level-color, #FF6B6B);
}

/* 雪花飘落效果（结束场景） */
.snowflake {
    position: absolute;
    top: -20px;
    color: #fff;
    font-size: 16px;
    user-select: none;
    pointer-events: none;
    animation: snowfall var(--fall-duration, 8s) linear var(--fall-delay, 0s) infinite;
    opacity: 0.7;
}

@keyframes snowfall {
    0% { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0; }
    10% { opacity: 0.7; }
    90% { opacity: 0.7; }
    100% { transform: translateY(100vh) translateX(50px) rotate(360deg); opacity: 0; }
}

/* ===== 响应式：移动端竖屏 ===== */
/* 移动端关闭 background-attachment: fixed（iOS 性能差，会导致背景缩放异常） */
@media (max-width: 768px) {
    .scene-auth .auth-bg,
    .scene-profile .profile-bg,
    .scene-guardian .guardian-bg,
    .scene-opening .bg-image,
    .scene-question .scene-bg {
        background-attachment: scroll;
    }
    /* 竖屏时背景偏上，露出更多画面主体 */
    .scene-opening .bg-image,
    .scene-question .scene-bg {
        background-position: center 25%;
    }
    /* 移动端视频全屏覆盖 */
    .story-video {
        object-fit: contain;
        background: #000;
    }
}

@media (max-width: 720px) {
    .scene-opening .title { font-size: 44px; letter-spacing: 4px; }
    .scene-opening .subtitle { font-size: 16px; margin-bottom: 60px; }
    .scene-opening .start-btn { padding: 18px 70px; font-size: 26px; letter-spacing: 8px; }
    .scene-question .question-text { font-size: 18px; padding: 14px 22px; }
    .scene-question .options-container { /* 尺寸由 JS 根据视频渲染区动态计算 */ }
    .scene-result .result-emoji { font-size: 80px; }
    .scene-result .result-card { padding: 30px 24px; }
    .scene-result .result-score .num { font-size: 38px; }
    .scene-result .result-logo img { max-height: 50px; }
}

@media (max-width: 480px) {
    .scene-opening .title { font-size: 36px; }
    .scene-opening .start-btn { padding: 16px 56px; font-size: 22px; letter-spacing: 6px; }
    .scene-question .question-text { font-size: 16px; }
    .scene-question .options-container { /* 尺寸由 JS 根据视频渲染区动态计算 */ }
    .scene-result .result-score .num { font-size: 32px; }
    .scene-result .result-logo img { max-height: 40px; }
}

/* ===== 响应式：PC 宽屏 ===== */
/* PC 端启用 fixed 背景实现视差效果，并优化大屏布局 */
@media (min-width: 1024px) {
    /* 背景图视差固定 */
    .scene-auth .auth-bg,
    .scene-profile .profile-bg,
    .scene-guardian .guardian-bg,
    .scene-opening .bg-image {
        background-attachment: fixed;
    }
    /* 题目场景背景也固定，但注意 JS 动态切换时需要重设 */
    .scene-question .scene-bg {
        background-attachment: fixed;
    }
    /* PC 端背景居中，宽屏不偏移 */
    .scene-opening .bg-image,
    .scene-question .scene-bg {
        background-position: center center;
    }
    /* 大屏内容卡片限制最大宽度，避免过度拉伸 */
    .scene-auth .auth-card { max-width: 440px; }
    .scene-profile .profile-card { max-width: 440px; }
    .scene-opening .title { font-size: 72px; }
    .scene-opening .subtitle { font-size: 24px; }
    .scene-result .result-card { max-width: 520px; }
}

/* ===== 响应式：横屏手机 / 矮屏设备 ===== */
/* 横屏时高度有限，缩小标题和间距防止内容溢出 */
@media (orientation: landscape) and (max-height: 500px) {
    .scene-opening .title { font-size: 32px; margin-bottom: 8px; }
    .scene-opening .subtitle { font-size: 14px; margin-bottom: 24px; }
    .scene-opening .start-btn { padding: 12px 48px; font-size: 20px; }
    .scene-question .options-container { /* 尺寸由 JS 根据视频渲染区动态计算 */ }
}

/* ====== 交接场景（答题完成→交给家长） ====== */
.scene-handover {
    background: linear-gradient(180deg, #FFF8E1 0%, #FFECB3 50%, #FFE0B2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.scene-handover .handover-bg {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    height: 100dvh;
    background-image: url('../images/scenes/opening_forest.jpg');
    background-size: cover;
    background-position: center center;
    opacity: 0.12;
}

.scene-handover .handover-card {
    position: relative;
    z-index: 2;
    background: rgba(255, 255, 255, 0.97);
    border-radius: 32px;
    padding: 48px 36px 36px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(255, 152, 0, 0.25);
    animation: cardEnter 0.8s ease-out;
}

.scene-handover .handover-bear {
    font-size: 72px;
    margin-bottom: 20px;
    animation: handoverWave 2s ease-in-out infinite;
}

@keyframes handoverWave {
    0%, 100% { transform: rotate(0deg) translateY(0); }
    25% { transform: rotate(-10deg) translateY(-4px); }
    75% { transform: rotate(10deg) translateY(-4px); }
}

.scene-handover .handover-content {
    margin-bottom: 36px;
}

.scene-handover .handover-title {
    font-size: 26px;
    font-weight: 800;
    color: #5D4037;
    margin-bottom: 16px;
}

.scene-handover .handover-text {
    font-size: 17px;
    color: #6D5847;
    line-height: 1.8;
}

.scene-handover .handover-btn {
    width: 100%;
    padding: 18px;
    border: none;
    border-radius: 50px;
    font-size: 19px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(180deg, #FFB74D 0%, #FF9800 100%);
    box-shadow: 0 6px 20px rgba(255, 152, 0, 0.4),
                inset 0 -3px 0 rgba(0, 0, 0, 0.12);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    letter-spacing: 3px;
    animation: handoverPulse 2s ease-in-out infinite;
}

.scene-handover .handover-btn:active {
    transform: scale(0.96);
    box-shadow: 0 3px 12px rgba(255, 152, 0, 0.3),
                inset 0 -2px 0 rgba(0, 0, 0, 0.12);
}

@keyframes handoverPulse {
    0%, 100% { box-shadow: 0 6px 20px rgba(255, 152, 0, 0.4), inset 0 -3px 0 rgba(0, 0, 0, 0.12); }
    50% { box-shadow: 0 8px 28px rgba(255, 152, 0, 0.65), inset 0 -3px 0 rgba(0, 0, 0, 0.12); }
}

.scene-handover .handover-tip {
    margin-top: 16px;
    font-size: 12px;
    color: #A0917F;
    letter-spacing: 1px;
}

/* ====== 支付弹窗 ====== */
.payment-modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.payment-modal .payment-mask {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
}

.payment-modal .payment-card {
    position: relative;
    z-index: 2;
    background: #fff;
    border-radius: 24px;
    padding: 36px 32px 28px;
    width: 88%;
    max-width: 360px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    animation: paymentEnter 0.4s ease-out;
}

@keyframes paymentEnter {
    from { opacity: 0; transform: scale(0.85) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.payment-modal .payment-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    transition: color 0.2s;
}

.payment-modal .payment-close:hover {
    color: #333;
}

.payment-modal .payment-title {
    font-size: 22px;
    font-weight: 700;
    color: #333;
    margin-bottom: 20px;
}

.payment-modal .payment-amount {
    margin-bottom: 24px;
}

.payment-modal .payment-amount-label {
    display: block;
    font-size: 13px;
    color: #999;
    margin-bottom: 4px;
}

.payment-modal .payment-amount-num {
    font-size: 36px;
    font-weight: 800;
    color: #FF6B6B;
}

.payment-modal .payment-qr-area {
    width: 200px;
    height: 200px;
    margin: 0 auto 20px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #eee;
    background: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.payment-modal .payment-qr-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.payment-modal .payment-qr-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: #ccc;
    font-size: 14px;
}

.payment-modal .payment-qr-placeholder-sub {
    font-size: 12px;
}

.payment-modal .payment-subtitle {
    font-size: 15px;
    color: #555;
    font-weight: 600;
    margin-bottom: 6px;
}

.payment-modal .payment-tip {
    font-size: 13px;
    color: #999;
    margin-bottom: 18px;
}

/* 免费试用（后台配置后才显示） */
.payment-modal .payment-trial-btn {
    display: block;
    width: 100%;
    margin: -4px 0 10px;
    padding: 12px;
    border: 2px solid #7ED957;
    border-radius: 10px;
    background: #F1F8E9;
    color: #558B2F;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.payment-modal .payment-trial-btn:hover  { background: #DCEDC8; }
.payment-modal .payment-trial-btn:active { transform: scale(0.98); }

.payment-modal .payment-trial-btn:disabled {
    opacity: 0.6;
    cursor: default;
    transform: none;
}

.payment-modal .payment-trial-note {
    font-size: 12px;
    color: #7CB342;
    margin: -4px 0 14px;
    line-height: 1.6;
}

.payment-modal .payment-trial-note.muted {
    color: #aaa;
}

.payment-modal .payment-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    color: #FF9800;
    padding: 10px;
    background: #FFF8E1;
    border-radius: 10px;
}

.payment-modal .payment-status.paid {
    color: #4CAF50;
    background: #E8F5E9;
}

.payment-modal .payment-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #FFE0B2;
    border-top-color: #FF9800;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.payment-modal .payment-debug-btn {
    display: block;
    width: 100%;
    margin-top: 14px;
    padding: 12px;
    border: 2px dashed #FF9800;
    border-radius: 10px;
    background: #FFF8E1;
    color: #FF9800;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.payment-modal .payment-debug-btn:hover {
    background: #FFE0B2;
}

.payment-modal .payment-debug-btn:active {
    transform: scale(0.97);
}

/* ====== 续答确认弹窗 ====== */
.resume-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.resume-modal .resume-dialog {
    width: 82%;
    max-width: 340px;
    background: #FFF8E1;
    border-radius: 24px;
    padding: 28px 24px 24px;
    text-align: center;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    animation: resumePop 0.32s ease;
}

@keyframes resumePop {
    from { transform: scale(0.85); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

.resume-modal .resume-icon {
    font-size: 42px;
    line-height: 1;
    margin-bottom: 10px;
}

.resume-modal .resume-title {
    font-size: 18px;
    font-weight: 700;
    color: #5D4037;
    margin: 0 0 8px;
}

.resume-modal .resume-desc {
    font-size: 14px;
    color: #8D6E63;
    margin: 0 0 20px;
    line-height: 1.6;
}

.resume-modal .resume-buttons {
    display: flex;
    gap: 12px;
}

.resume-modal .resume-btn {
    flex: 1;
    padding: 12px 0;
    border: none;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.resume-modal .resume-btn:active {
    transform: scale(0.96);
}

.resume-modal .resume-btn-restart {
    background: #fff;
    color: #8D6E63;
    border: 1px solid #D7CCC8;
}

.resume-modal .resume-btn-continue {
    background: linear-gradient(135deg, #FF8F00, #F57C00);
    color: #fff;
    box-shadow: 0 4px 12px rgba(245, 124, 0, 0.35);
}

/* ==================================================================
   横竖屏自适应（微信内置浏览器）
   ------------------------------------------------------------------
   背景：微信 X5 / iOS WKWebView 下 100dvh 表现不一致，且 html/body 为
   overflow:hidden，横屏时内容一旦超高就会被裁掉且无法滚动。
   处理方式：
     1) 所有卡片限高并可内部滚动，横屏矮屏也不会被裁；
     2) --appvh 由 JS 按 window.innerHeight 实时兜底；
     3) 横屏专用查询压缩内边距与字号；
     4) iPhone 横屏左右刘海安全区。
   ================================================================== */

/* ---- 1. 卡片限高 + 内部滚动（横竖屏通用，矮屏时最关键的一层保险） ---- */
.scene-auth .auth-card,
.scene-profile .profile-card,
.scene-handover .handover-card,
.payment-modal .payment-card,
.resume-modal .resume-dialog {
    max-height: calc(var(--appvh, 100dvh) - 24px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* 结果卡由外层 .scene-result 负责滚动，这里只做兜底限高 */
.scene-result .result-card {
    max-height: none;
}

/* 监护告知书：横屏时把可用高度吃满，正文区内部滚动 */
.scene-guardian .guardian-card {
    max-height: calc(var(--appvh, 100dvh) - 24px);
}

/* ---- 2. 横屏（含手机横屏与矮屏平板） ---- */
@media (orientation: landscape) and (max-height: 560px) {
    /* 关闭背景视差，避免 fixed 背景在旋转后错位/抖动 */
    .scene-auth .auth-bg,
    .scene-profile .profile-bg,
    .scene-guardian .guardian-bg,
    .scene-opening .bg-image,
    .scene-question .scene-bg {
        background-attachment: scroll !important;
    }

    /* 登录 / 信息补全：压缩 logo 与间距，5 个输入框也能放下或滚动 */
    .scene-auth { padding: 10px 0; }
    .scene-auth .auth-card {
        padding: 16px 24px;
        border-radius: 20px;
        max-width: 440px;
    }
    .scene-auth .auth-logo { font-size: 34px; line-height: 1; }
    .scene-auth .auth-title { font-size: 20px; }
    .scene-auth .auth-subtitle { font-size: 12px; margin-bottom: 10px; }
    .scene-auth .input-group { margin-bottom: 8px; }
    .scene-auth .input-group label { font-size: 12px; margin-bottom: 4px; }
    .scene-auth .input-group input,
    .scene-profile .profile-card select { padding: 8px 12px; font-size: 14px; }
    .scene-auth .auth-btn { padding: 10px; font-size: 15px; }
    .scene-auth .auth-switch { margin-top: 10px; font-size: 12px; }
    .scene-auth .error-msg { font-size: 12px; }

    .scene-profile { padding: 10px 0; }
    .scene-profile .profile-card {
        padding: 14px 24px;
        border-radius: 20px;
        max-width: 440px;
    }
    .scene-profile .profile-logo { font-size: 30px; line-height: 1; }
    .scene-profile .profile-title { font-size: 19px; }
    .scene-profile .profile-subtitle { font-size: 12px; }
    .scene-profile .input-group { margin-bottom: 8px; }

    /* 监护告知书 */
    .scene-guardian { padding: 8px 0; }
    .scene-guardian .guardian-card {
        max-width: 640px;
        border-radius: 16px;
    }
    .scene-guardian .guardian-header { padding: 10px 20px 6px; }
    .scene-guardian .guardian-icon { font-size: 22px; }
    .scene-guardian .guardian-title { font-size: 16px; }
    .scene-guardian .guardian-content { padding: 10px 20px; font-size: 13px; }
    .scene-guardian .guardian-footer { padding: 8px 20px 12px; }
    .scene-guardian .guardian-check-text { font-size: 12px; }

    /* 交接页 */
    .scene-handover { padding: 10px 0; }
    .scene-handover .handover-card {
        padding: 16px 24px;
        border-radius: 20px;
        max-width: 420px;
    }
    .scene-handover .handover-bear { font-size: 38px; margin-bottom: 8px; }
    .scene-handover .handover-content { margin-bottom: 16px; }
    .scene-handover .handover-title { font-size: 19px; margin-bottom: 8px; }
    .scene-handover .handover-text { font-size: 14px; }
    .scene-handover .handover-btn { padding: 12px; font-size: 16px; }

    /* 开场页 */
    .scene-opening .title { font-size: 32px; margin-bottom: 6px; }
    .scene-opening .subtitle { font-size: 14px; margin-bottom: 18px; }
    .scene-opening .start-btn { padding: 12px 48px; font-size: 20px; }
    .scene-opening .bottom-tip { font-size: 12px; }

    /* 中转页 */
    .scene-hub .hub-logo { font-size: 40px; margin-bottom: 6px; }
    .scene-hub .hub-title { font-size: 30px; }
    .scene-hub .hub-subtitle { font-size: 14px; margin-bottom: 16px; }
    .scene-hub .hub-btn { padding: 12px 20px; font-size: 15px; }

    /* 结果页 */
    .scene-result { padding: 12px 16px; }
    .scene-result .result-card { padding: 20px 24px; border-radius: 20px; }

    /* 支付弹窗：压缩二维码与间距，横屏矮屏一屏放下（仍超高时卡片内部滚动） */
    .payment-modal .payment-card {
        width: 92%;
        max-width: 420px;
        padding: 14px 20px;
    }
    .payment-modal .payment-close { top: 6px; right: 12px; }
    .payment-modal .payment-qr-area {
        width: 118px;
        height: 118px;
        margin: 0 auto 8px;
    }
    .payment-modal .payment-title { font-size: 17px; margin-bottom: 8px; }
    .payment-modal .payment-amount { margin-bottom: 10px; }
    .payment-modal .payment-amount-num { font-size: 26px; }
    .payment-modal .payment-subtitle { font-size: 13px; margin-bottom: 3px; }
    .payment-modal .payment-tip { font-size: 12px; margin-bottom: 8px; }
    .payment-modal .payment-trial-btn { margin: 0 0 8px; padding: 10px; font-size: 14px; }
    .payment-modal .payment-trial-note { margin: 0 0 10px; font-size: 11px; }
    .payment-modal .payment-status { padding: 7px; font-size: 12px; }
    .payment-modal .payment-debug-btn { margin-top: 8px; padding: 8px; font-size: 12px; }

    /* 续答弹窗 */
    .resume-modal .resume-dialog { padding: 18px 22px 16px; max-width: 420px; }
    .resume-modal .resume-icon { font-size: 30px; }
    .resume-modal .resume-title { font-size: 16px; }
}

/* ---- 3. iPhone 横屏左右安全区（刘海 / Home 指示条） ---- */
@supports (padding: env(safe-area-inset-left)) {
    @media (orientation: landscape) {
        .scene-auth,
        .scene-profile,
        .scene-guardian,
        .scene-handover,
        .scene-hub,
        .scene-opening,
        .scene-result,
        .payment-modal,
        .resume-modal {
            /* 用 max() 保留原有左右留白，只在刘海机型上额外加宽 */
            padding-left: max(16px, env(safe-area-inset-left));
            padding-right: max(16px, env(safe-area-inset-right));
        }
    }
}

/* ---- 4. 竖屏矮屏（如 568px 高的老机型）同样保底 ---- */
@media (orientation: portrait) and (max-height: 640px) {
    .scene-auth .auth-logo { font-size: 52px; }
    .scene-auth .auth-card { padding: 32px 28px; }
    .scene-handover .handover-bear { font-size: 54px; margin-bottom: 12px; }
}

/* ==================================================================
 * 播放倍速条（开场视频 / 27 题视频）
 * ------------------------------------------------------------------
 * 固定在右下角：竖屏时落在视频渲染区（object-fit:contain 的信封边）下方，
 * 完全避开三个小熊白框热区（纵向 20.4%~66.6%）与底部提示文字（bottom:50px）。
 * z-index 45：高于选项热区(10)与提示(10)，低于题间过渡层(50)与弹窗(9999)，
 *            因此切题过渡、支付弹窗、续答弹窗出现时会被正确遮挡。
 * 显示/隐藏由 JS 按场景控制（.is-on），只在有视频播放的场景出现。
 * ================================================================== */
.rate-bar {
    position: fixed;
    right: 12px;
    bottom: 92px;
    z-index: 45;
    display: none;
    align-items: center;
    gap: 6px;
    padding: 5px 9px 5px 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .45);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}
.rate-bar.is-on { display: flex; }

.rate-bar-label {
    color: rgba(255, 255, 255, .82);
    font-size: 12px;
    letter-spacing: 1px;
    user-select: none;
    -webkit-user-select: none;
}

.rate-bar-btns {
    display: flex;
    gap: 4px;
}

.rate-btn {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid rgba(255, 255, 255, .35);
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    padding: 6px 9px;
    border-radius: 999px;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease, transform .1s ease;
}
.rate-btn:active { transform: scale(.94); }
.rate-btn.is-active {
    background: #7ED957;
    border-color: #7ED957;
    color: #2E4A1C;
    box-shadow: 0 0 10px rgba(126, 217, 87, .5);
}

/* 横屏矮屏：视频铺满高度，小熊热区下沿约在 66.6% 处，倍速条压到最底部避开 */
@media (orientation: landscape) and (max-height: 560px) {
    .rate-bar {
        right: 10px;
        bottom: 6px;
        padding: 4px 8px 4px 9px;
    }
    .rate-btn { padding: 5px 8px; font-size: 12px; }
}

/* ================================================================
 * 弱网容错 UI：网络状态横幅 + 视频加载异常提示条
 * 分层沿用既有约定：选项层 10 / 倍速条 45 / 提示条 46 / 转场 50 / 星星 100 / 弹层 9999
 * 两者默认都不渲染（hidden），正常网络下对界面净影响为 0
 * ================================================================ */

/* 顶部网络状态横幅：断网 / 弱网提示，恢复后自动淡出 */
.net-banner {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 9990;
    padding: 7px 12px;
    text-align: center;
    font-size: 13px;
    line-height: 1.4;
    color: #5A3D00;
    background: rgba(255, 193, 7, .96);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
    transform: translateY(-100%);
    transition: transform .25s ease, opacity .25s ease;
    pointer-events: none;
}
.net-banner.show { transform: translateY(0); }
.net-banner-offline {
    color: #fff;
    background: rgba(217, 83, 79, .96);
}

/* 视频加载异常提示条：置于播放区顶部条状，
   纵向避开 ABC 三个小熊框（20.4% ~ 66.6%），不会遮挡作答 */
.video-notice {
    position: absolute;
    top: 8%;
    left: 50%;
    margin-left: -44%;
    width: 88%;
    z-index: 46;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .62);
    color: #fff;
    font-size: 13px;
    line-height: 1.3;
    opacity: 0;
    transition: opacity .2s ease;
}
.video-notice.show { opacity: 1; }
.video-notice[hidden] { display: none; }
.video-notice-text { flex: 0 1 auto; }
.video-notice-btns { display: flex; gap: 8px; }
.video-notice-btn {
    padding: 5px 12px;
    border: 1px solid rgba(255, 255, 255, .55);
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: background .18s ease, transform .1s ease;
}
.video-notice-btn:active { transform: scale(.94); }
.video-notice-btn.primary {
    background: #7ED957;
    border-color: #7ED957;
    color: #2E4A1C;
}
