/* 主要样式文件 - 机顶盒H5适配 */
/* Main CSS for STB H5 adaptation */

/* 通用工具类 */
.hidden { display: none !important; }

/* 应用容器 */
.app-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    background: transparent;
    overflow: hidden;
}

/* 页面基础样式 */
.page {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0;
}
.page.active {
    z-index: 1;
    opacity: 1;
}

/* 加载界面 */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-size: 18px;
    color: #fff;
    font-weight: 300;
}

/* 预告页样式 */
.preview-container {
    position: relative;
    width: 100%;
    height: 100%;
    /* background: #000; */
    background: transparent;
}

.video-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.preview-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, rgba(0,0,0,0.3), transparent);
    display: flex;
    justify-content: center;
    align-items: center;
}

.lion-animation {
    width: 200px;
    height: 200px;
    background: url('../images/lion.gif') center/cover no-repeat;
    animation: lionPulse 2s ease-in-out infinite;
}

@keyframes lionPulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; }
}

.preview-controls {
    position: absolute;
    bottom: 60px;
    right: 60px;
    z-index: 10;
}

.skip-button {
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: 2px solid #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 120px;
}

.skip-button:hover,
.skip-button.focus {
    background: #fff;
    color: #000;
    transform: scale(1.05);
}

/* 故事页样式 */
.story-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: transparent;
}

.story-video-container {
    flex: 1;
    position: relative;
    background: transparent;
    overflow: hidden;
}

.story-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: transparent;
}

.interaction-area {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.9));
    padding: 20px;
    min-height: 200px;
}

.question-display,
.answer-display {
    margin-bottom: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-size: 16px;
    line-height: 1.6;
    min-height: 60px;
    display: flex;
    align-items: center;
}

.recording-controls {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.record-button {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 15px 30px;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    min-width: 180px;
    justify-content: center;
}

.record-button:hover,
.record-button.focus {
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(255, 107, 107, 0.4);
}

.record-button.recording {
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    animation: pulse 1.5s ease-in-out infinite;
}

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

.record-icon::before {
    content: '🎤';
    font-size: 20px;
}

.voice-status {
    text-align: center;
    margin-top: 15px;
}

.status-text {
    font-size: 14px;
    color: #4ecdc4;
    margin-bottom: 10px;
    font-weight: 500;
}

.voice-wave {
    display: flex;
    justify-content: center;
    align-items: end;
    gap: 4px;
    height: 30px;
}

.wave-bar {
    width: 4px;
    background: #4ecdc4;
    border-radius: 2px;
    animation: waveAnimation 1.5s ease-in-out infinite;
}

.wave-bar:nth-child(1) { animation-delay: 0s; }
.wave-bar:nth-child(2) { animation-delay: 0.1s; }
.wave-bar:nth-child(3) { animation-delay: 0.2s; }
.wave-bar:nth-child(4) { animation-delay: 0.3s; }

@keyframes waveAnimation {
    0%, 100% { height: 10px; }
    50% { height: 25px; }
}

/* 控制按钮 */
.story-controls {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

.control-btn {
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    min-width: 100px;
    justify-content: center;
}

.control-btn:hover,
.control-btn.focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: #fff;
    transform: scale(1.05);
}

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    font-size: 16px;
    display: inline-block;
}

/* 评分弹窗 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
}

.modal-content {
    position: relative;
    background: linear-gradient(135deg, #2c3e50, #34495e);
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.4s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: scale(0.8) translateY(-20px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.rating-stars {
    margin-bottom: 30px;
}

.stars-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.star {
    font-size: 48px;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.5;
}

.star:hover,
.star.active {
    opacity: 1;
    transform: scale(1.2);
    filter: brightness(1.2);
}

.rating-text {
    font-size: 18px;
    color: #ecf0f1;
    font-weight: 300;
}

.rating-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.rating-btn {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 15px 30px;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    min-width: 140px;
}

.rating-btn:hover,
.rating-btn.focus {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.4);
}

.rating-btn:nth-child(2) {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
}

/* 焦点样式 - 遥控器适配 */
.focusable:focus {
    outline: 3px solid #4ecdc4;
    outline-offset: 2px;
    -webkit-outline:3px solid #4ecdc4;
    -webkit-outline-offset: 2px;
}

/* 响应式设计 - 适配不同屏幕比例 */
@media screen and (max-width: 1280px) {
    .preview-controls {
        bottom: 40px;
        right: 40px;
    }

    .skip-button {
        padding: 10px 20px;
        font-size: 14px;
    }

    .lion-animation {
        width: 150px;
        height: 150px;
    }
}

@media screen and (max-height: 720px) {
    .interaction-area {
        min-height: 150px;
        padding: 15px;
    }

    .record-button {
        padding: 12px 24px;
        font-size: 14px;
    }

    .story-controls {
        bottom: 15px;
    }

    .control-btn {
        padding: 10px 16px;
        font-size: 12px;
        min-width: 80px;
    }
}

/* 性能优化 - 减少重绘 */
.transform-gpu {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* 故事页返回按钮 */
.story-back-btn {
    position: fixed;
    top: 24px;
    left: 24px;
    width: 72px;
    height: 72px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    z-index: 10000;
    -webkit-tap-highlight-color: transparent;
    opacity: 0.9;
}
.story-back-btn img {
    width: 100%;
    height: 100%;
    display: block;
}
.story-back-btn:focus,
.story-back-btn:hover {
    opacity: 1;
    outline: none;
}

/* 故事页进度条 */
.story-progress-wrap {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 64px;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    padding: 0 20px;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 100%);
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    z-index: 9999;
}
/* 播放/暂停按钮 */
.story-pp-btn {
    width: 48px;
    height: 48px;
    background: none;
    border: none;
    padding: 0;
    margin-right: 14px;
    cursor: pointer;
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    opacity: 0.9;
}
.story-pp-btn img {
    width: 100%;
    height: 100%;
    display: block;
}
.story-pp-btn:focus,
.story-pp-btn:hover {
    opacity: 1;
    outline: none;
}
.story-time-current,
.story-time-total {
    color: #fff;
    font-size: 22px;
    font-family: Monaco, Consolas, monospace;
    min-width: 52px;
    text-align: center;
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}
.story-progress-bar {
    position: relative;
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    flex: 1;
    height: 6px;
    background: rgba(255,255,255,0.3);
    border-radius: 3px;
    margin: 0 14px;
}
.story-progress-inner {
    height: 100%;
    background: #FFD138;
    width: 0%;
    -webkit-transition: width 0.5s linear;
    transition: width 0.5s linear;
    border-radius: 3px;
}
.story-progress-thumb {
    position: absolute;
    top: 50%;
    left: 0%;
    width: 20px;
    height: 20px;
    background: #fff;
    border: 3px solid #FFD138;
    border-radius: 50%;
    -webkit-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
    -webkit-transition: left 0.5s linear;
    transition: left 0.5s linear;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

/* 故事页按钮焦点样式 */
.story-pp-btn:focus,
.story-back-btn:focus {
    outline: none;
    /* -webkit-box-shadow: 0 0 0 3px #FFD138, 0 0 12px 4px rgba(255,209,56,0.7);
    box-shadow: 0 0 0 3px #FFD138, 0 0 12px 4px rgba(255,209,56,0.7); */
    border-radius: 50%;
    opacity: 1;
}
.story-pp-btn:focus img,
.story-back-btn:focus img {
    -webkit-transform: scale(1.1);
    transform: scale(1.1);
    -webkit-transition: transform 0.15s ease;
    transition: transform 0.15s ease;
}

/* 返回确认蒙层 */
.back-confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.75);
    z-index: 20000;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
}
.back-confirm-modal.hidden {
    display: none;
}
.back-confirm-content {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-orient: horizontal;
    -webkit-box-direction: normal;
    -webkit-flex-direction: row;
    flex-direction: row;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
    gap: 80px;
}
.back-confirm-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    width: 180px;
    height: 180px;
    -webkit-tap-highlight-color: transparent;
    border-radius: 20px;
    opacity: 0.9;
}
.back-confirm-btn img {
    width: 100%;
    height: 100%;
    display: block;
}
.back-confirm-btn:focus {
    outline: none;
    opacity: 1;
    -webkit-box-shadow: 0 0 0 4px #FFD138, 0 0 20px 8px rgba(255,209,56,0.6);
    box-shadow: 0 0 0 4px #FFD138, 0 0 20px 8px rgba(255,209,56,0.6);
    border-radius: 20px;
    -webkit-transform: scale(1.08);
    transform: scale(1.08);
}

/* 返回确认蒙层 */
.back-confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 20000;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
}
.back-confirm-modal.hidden {
    display: none;
}
.back-confirm-content {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-orient: horizontal;
    -webkit-box-direction: normal;
    -webkit-flex-direction: row;
    flex-direction: row;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
    gap: 80px;
}
.back-confirm-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    width: 160px;
    height: 160px;
    -webkit-tap-highlight-color: transparent;
    border-radius: 16px;
    opacity: 0.9;
}
.back-confirm-btn img {
    width: 100%;
    height: 100%;
    display: block;
}
.back-confirm-btn:focus {
    outline: none;
    opacity: 1;
    -webkit-box-shadow: 0 0 0 4px #FFD138, 0 0 20px 8px rgba(255,209,56,0.6);
    box-shadow: 0 0 0 4px #FFD138, 0 0 20px 8px rgba(255,209,56,0.6);
    border-radius: 16px;
    -webkit-transform: scale(1.08);
    transform: scale(1.08);
}

/* 返回确认蒙层 */
.back-confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 20000;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
}
.back-confirm-modal.hidden {
    display: none;
}
.back-confirm-content {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-orient: horizontal;
    -webkit-box-direction: normal;
    -webkit-flex-direction: row;
    flex-direction: row;
    gap: 60px;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
}
.back-confirm-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    width: 160px;
    height: 160px;
    -webkit-tap-highlight-color: transparent;
    border-radius: 16px;
    -webkit-transition: transform 0.15s ease;
    transition: transform 0.15s ease;
}
.back-confirm-btn img {
    width: 100%;
    height: 100%;
    display: block;
}
.back-confirm-btn:focus {
    outline: none;
    -webkit-box-shadow: 0 0 0 4px #FFD138, 0 0 16px 6px rgba(255,209,56,0.7);
    box-shadow: 0 0 0 4px #FFD138, 0 0 16px 6px rgba(255,209,56,0.7);
    border-radius: 16px;
    -webkit-transform: scale(1.08);
    transform: scale(1.08);
}

