/* ===== 挑战答题主页样式 ===== */

.challenge-main-page {
    position: relative;
    width: 100%;
    min-height: 100vh;
    max-width: 430px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
}

.challenge-status-bar {
    position: relative;
    z-index: 20;
    width: 100%;
}

.challenge-bg-wrap {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    overflow: hidden;
}

.challenge-bg-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

.challenge-header {
    position: relative;
    width: 100%;
    padding: 12px 16px;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.challenge-back-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.challenge-back-btn:active {
    transform: scale(0.95);
    background: rgba(0, 0, 0, 0.5);
}

.challenge-rules-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #FBE1A9;
    color: #D2232A;
    font-weight: bold;
    border-radius: 9999px;
    border: 2px solid #D2232A;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    font-size: 14px;
}

.challenge-wrong-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #FBE1A9;
    color: #D2232A;
    font-weight: bold;
    border-radius: 9999px;
    border: 2px solid #D2232A;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    font-size: 14px;
    cursor: pointer;
}

.challenge-header-btns {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.challenge-title-wrap {
    position: relative;
    z-index: 10;
    text-align: center;
    margin-top: 30px;
    padding: 0 32px;
}

.challenge-title {
    font-size: 36px;
    font-weight: 900;
    color: #FBE1A9;
    text-shadow: 
        2px 2px 0 #D2232A, 
        -2px -2px 0 #D2232A, 
        2px -2px 0 #D2232A, 
        -2px 2px 0 #D2232A,
        0 4px 8px rgba(0,0,0,0.5);
    -webkit-text-stroke: 1px #D2232A;
    letter-spacing: 4px;
    line-height: 1.3;
}

.challenge-center {
    position: relative;
    z-index: 10;
    width: 100%;
    padding: 0 40px;
    margin-top: auto;
    margin-bottom: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.challenge-chances-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    width: 100%;
    justify-content: center;
}

.challenge-chances-line {
    width: 32px;
    height: 1px;
    background: #8B0000;
}

.challenge-chances-text {
    color: #000000;
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 1px;
}

.challenge-chances-num {
    color: #A52A2A;
    font-size: 20px;
    font-weight: bold;
    margin: 0 2px;
}

.challenge-start-btn {
    width: 100%;
    padding: 14px;
    border-radius: 9999px;
    font-size: 24px;
    font-weight: 900;
    letter-spacing: 8px;
    position: relative;
    transition: all 0.15s;
}

.challenge-start-btn.active {
    background: linear-gradient(135deg, #FF6B4A 0%, #E62B2B 100%);
    color: white;
    box-shadow: 
        0 6px 0 #C41E1E,
        0 10px 20px rgba(230, 43, 43, 0.3);
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    animation: bounceUpDown 1.5s ease-in-out infinite;
}

.challenge-start-btn.active:active {
    transform: translateY(4px);
    box-shadow: 
        0 2px 0 #C41E1E,
        0 4px 10px rgba(230, 43, 43, 0.3);
}

.challenge-start-btn.disabled {
    background: linear-gradient(135deg, #9CA3AF 0%, #6B7280 100%);
    color: white;
    box-shadow: 
        0 6px 0 #4B5563,
        0 10px 20px rgba(0,0,0,0.2);
    pointer-events: none;
}

.challenge-reset-btn {
    margin-top: 24px;
    color: #4A3428;
    text-decoration: underline;
    font-size: 12px;
}

@keyframes bounceUpDown {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* ===== 规则弹窗 ===== */

.challenge-rules-modal {
    position: absolute;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.challenge-rules-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.challenge-rules-content {
    position: relative;
    width: 100%;
    max-width: 340px;
    background: #FFF8E7;
    border-radius: 16px;
    border: 4px solid #D2232A;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.challenge-rules-header {
    background: #D2232A;
    color: #FBE1A9;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.challenge-rules-header h2 {
    font-size: 18px;
    font-weight: bold;
    letter-spacing: 4px;
}

.challenge-rules-close {
    color: #FBE1A9;
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
}

.challenge-rules-body {
    padding: 24px;
    color: #5a2e15;
    font-size: 14px;
    line-height: 1.6;
}

.challenge-rules-body .highlight {
    color: #D2232A;
    font-weight: bold;
}

.challenge-rules-body .highlight-title {
    color: #D2232A;
    font-weight: bold;
    margin-top: 8px;
}

.challenge-rules-body .bold {
    font-weight: bold;
}

.challenge-rules-divider {
    height: 1px;
    background: rgba(210, 35, 42, 0.2);
    margin: 12px 0;
}

.challenge-rules-footer {
    padding: 16px;
    display: flex;
    justify-content: center;
}

.challenge-rules-confirm {
    background: #D2232A;
    color: #FBE1A9;
    padding: 8px 40px;
    border-radius: 9999px;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.challenge-rules-confirm:active {
    transform: scale(0.95);
}

/* ===== 挑战答题页面 ===== */

.challenge-quiz-page {
    position: relative;
    width: 100%;
    min-height: 100vh;
    max-width: 430px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.challenge-quiz-status-bar {
    position: relative;
    z-index: 20;
    width: 100%;
}

.challenge-quiz-bg-wrap {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.challenge-quiz-bg-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.9;
}

.challenge-quiz-topbar {
    position: relative;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
}

/* 答题界面返回按钮 */
.challenge-quiz-back-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.challenge-quiz-back-btn:active {
    transform: scale(0.9);
    background: rgba(0, 0, 0, 0.6);
}

.challenge-quiz-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.4);
    padding: 6px 12px;
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.challenge-quiz-score-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FFE066 0%, #FFB300 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(255, 179, 0, 0.3);
}

.challenge-quiz-timer {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 9999px;
    font-weight: bold;
    font-size: 18px;
    background: rgba(37, 99, 235, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    color: white;
}

.challenge-quiz-timer.warning {
    background: rgba(239, 68, 68, 0.8);
    border-color: rgba(255, 255, 255, 0.8);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.challenge-quiz-content {
    position: relative;
    z-index: 10;
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    margin-top: 20px;
}

.challenge-quiz-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border-radius: 24px;
    padding: 24px;
    margin-bottom: 24px;
    border: 4px solid #D2232A;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
    position: relative;
}

.challenge-quiz-badge {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    background: #D2232A;
    color: #FBE1A9;
    padding: 4px 24px;
    border-radius: 9999px;
    font-weight: bold;
    border: 2px solid #FBE1A9;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.challenge-quiz-question {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    text-align: center;
    line-height: 1.5;
    margin-top: 16px;
}

.challenge-quiz-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.challenge-quiz-option {
    width: 100%;
    padding: 18px 20px;
    border-radius: 16px;
    border-bottom: 4px solid #D1D5DB;
    font-size: 16px;
    font-weight: bold;
    text-align: left;
    background: white;
    color: #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.challenge-quiz-option:hover:not(:disabled) {
    background: #F3F4F6;
    border-color: #9CA3AF;
}

.challenge-quiz-option:active:not(:disabled) {
    transform: scale(0.98);
}

.challenge-quiz-option.correct {
    background: linear-gradient(135deg, #22C55E 0%, #16A34A 100%);
    color: white !important;
    border-color: #15803D;
    box-shadow: 
        0 0 20px rgba(34, 197, 94, 0.6),
        inset 0 2px 4px rgba(255, 255, 255, 0.2);
    transform: scale(1.02);
}

.challenge-quiz-option.wrong {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    color: white !important;
    border-color: #B91C1C;
    box-shadow: 
        0 0 20px rgba(239, 68, 68, 0.6),
        inset 0 2px 4px rgba(255, 255, 255, 0.2);
    transform: scale(1.02);
}

.challenge-quiz-option.disabled {
    background: rgba(255, 255, 255, 0.5);
    color: #9CA3AF;
    border-color: #E5E7EB;
    opacity: 0.5;
}

/* ===== 挑战结算弹窗（参考 eg/src/app/App.tsx）===== */

/* --- 入场动画关键帧 --- */

/* 遮罩层淡入 */
@keyframes resultOverlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 弹窗内容弹性缩放入场 - 从上方进入，避免超出窗口 */
@keyframes resultContentIn {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(-60px);
    }
    60% {
        opacity: 1;
        transform: scale(1.02) translateY(2px);
    }
    80% {
        transform: scale(0.99) translateY(-1px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* 数字从下方滑入+淡入 */
@keyframes resultValueIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 按钮从下方弹入 */
@keyframes resultBtnIn {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.8);
    }
    70% {
        opacity: 1;
        transform: translateY(-3px) scale(1.05);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 关闭按钮淡入旋转 */
@keyframes resultCloseIn {
    from {
        opacity: 0;
        transform: rotate(-90deg) scale(0.5);
    }
    to {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }
}

/* --- 弹窗容器 --- */

.challenge-result-modal {
    position: absolute;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: resultOverlayIn 0.3s ease-out both;
}

.challenge-result-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.challenge-result-content {
    position: relative;
    width: 100%;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    animation: resultContentIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    animation-delay: 0.1s;
}

.challenge-result-content .bg-img {
    width: 100%;
    height: auto;
    display: block;
    pointer-events: none;
}

/* 右上角关闭按钮 - 无边框无背景 */
.result-close-btn {
    position: absolute;
    top: 69px;
    right: 48px;
    z-index: 10;
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, opacity 0.15s;
    animation: resultCloseIn 0.4s ease-out both;
    animation-delay: 0.35s;
}

.result-close-btn:active {
    transform: scale(0.9);
    opacity: 0.7;
}

/* 时间数字 - top:40%, left:59% 对齐"平均所用时长："冒号后 */
.result-time-value {
    position: absolute;
    top: 40%;
    left: 59%;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 2px;
    background: linear-gradient(to bottom, #FFF5C3, #FFB700);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
    animation: resultValueIn 0.4s ease-out both;
    animation-delay: 0.3s;
}

/* 积分数字 - top:50%, left:55% 对齐"收获积分："冒号后 */
.result-score-value {
    position: absolute;
    top: 50%;
    left: 55%;
    font-size: 26px;
    font-weight: 900;
    letter-spacing: 2px;
    background: linear-gradient(to bottom, #FFF5C3, #FFB700);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
    animation: resultValueIn 0.4s ease-out both;
    animation-delay: 0.4s;
}

/* 底部按钮区域 - bottom:18% */
.challenge-result-footer {
    position: absolute;
    bottom: 19%;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 0 20px;
    box-sizing: border-box;
}

/* 渐变黄色边框按钮（参考App.tsx ActionButton） */
.challenge-result-btn {
    position: relative;
    flex: 1;
    max-width: 110px;
    border-radius: 9999px;
    padding: 2px;
    cursor: pointer;
    background: linear-gradient(to bottom, #FFF5C3, #FFD438, #FFA200);
    box-shadow: 0 4px 8px rgba(0,0,0,0.25);
    transition: all 0.15s;
    border: none;
    animation: resultBtnIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* 第一个按钮稍早入场 */
.challenge-result-btn:nth-child(1) {
    animation-delay: 0.45s;
}

/* 第二个按钮稍晚入场 */
.challenge-result-btn:nth-child(2) {
    animation-delay: 0.55s;
}

.challenge-result-btn:active {
    transform: scale(0.95);
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.2);
}

/* 按钮内部容器 */
.challenge-result-btn-inner {
    width: 100%;
    padding: 7px 6px;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to bottom, #FFE885, #FFBA00);
    box-shadow:
        inset 0 2px 4px rgba(255,255,255,0.7),
        inset 0 -2px 6px rgba(210,100,0,0.4);
}

/* 按钮文字 - 粽红色/深棕色 */
.challenge-result-btn-text {
    color: #6D2914;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 3px;
    text-shadow: 0 1px 0 rgba(255,255,255,0.4);
}