/* ====================================
   儿童互动视频网页 - 样式表
   适合安卓平板，按钮大，风格简洁明亮
   ==================================== */

/* 全局样式重置和基础设置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 基础样式 */
body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    color: #333;
    min-height: 100vh;
    overflow: hidden; /* 防止滚动 */
}

/* 页面切换控制 */
.page {
    display: none;
    width: 100%;
    min-height: 100vh;
}

.page.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 隐藏类 */
.hidden {
    display: none !important;
}

/* ====================================
   主题选择页
   ==================================== */
#theme-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.selector-container {
    width: min(90vw, 600px);
    padding: 40px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.selector-container h1 {
    text-align: center;
    color: #667eea;
    margin-bottom: 30px;
    font-size: 28px;
}

.selector-container select {
    width: 100%;
    padding: 15px;
    margin-bottom: 20px;
    border: 2px solid #ddd;
    border-radius: 12px;
    font-size: 18px;
    background-color: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.selector-container select:focus {
    outline: none;
    border-color: #667eea;
}

.selector-container select:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.6;
}

/* ====================================
   用户信息表单页
   ==================================== */
#user-form-page {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.form-wrapper {
    width: min(90vw, 500px);
    padding: 50px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.form-wrapper h2 {
    text-align: center;
    color: #667eea;
    margin-bottom: 30px;
    font-size: 28px;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: bold;
    color: #333;
    font-size: 18px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 12px;
    font-size: 18px;
    outline: none;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    border-color: #667eea;
}

.submit-btn {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.submit-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.submit-btn:active {
    transform: scale(0.98);
}

.secondary-btn {
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
}

#open-report-btn {
    margin-top: 8px;
}

/* ====================================
   报告页面
   ==================================== */
#report-page {
    background: linear-gradient(135deg, #8bd3dd 0%, #ffe08a 100%);
}

#report-page.page.active {
    display: block;
    position: fixed;
    inset: 0;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0;
    z-index: 20;
}

.report-page-shell {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 24px 24px 88px;
}

.report-panel {
    width: 100%;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.report-toolbar-card {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 24px;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.12);
    padding: 24px 24px 20px;
}

.report-panel h2 {
    text-align: center;
    color: #667eea;
    margin-bottom: 20px;
    font-size: 30px;
    line-height: 1.3;
}

.report-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 18px;
    margin-bottom: 18px;
}

.report-form-grid .form-group {
    margin-bottom: 0;
}

.report-form-grid .form-group label {
    font-size: 16px;
    margin-bottom: 8px;
}

.report-form-grid .form-group input,
.report-form-grid .form-group select {
    background: #f8fafc;
}

.report-button-row,
.report-result-shell,
.report-result {
    width: 100%;
}

.report-button-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.report-button-row .submit-btn {
    min-height: 56px;
    font-size: 18px;
}

.report-result-shell {
    display: block;
}

.report-status {
    min-height: 24px;
    margin-bottom: 0;
    text-align: left;
    font-size: 16px;
    font-weight: 700;
    color: #475569;
    line-height: 1.6;
}

.report-status.error {
    color: #b91c1c;
}

.report-status.info {
    color: #475569;
}

.report-result {
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow: visible;
}

.report-placeholder,
.report-section {
    width: 100%;
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 22px;
    padding: 24px;
    box-shadow: 0 16px 38px rgba(15, 23, 42, 0.1);
}

.report-placeholder {
    background: rgba(248, 250, 252, 0.98);
    color: #475569;
    line-height: 1.8;
    font-size: 17px;
}

.report-section h3 {
    margin-bottom: 0;
    color: #334155;
    font-size: 22px;
    line-height: 1.4;
}

.report-section-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 18px;
}

.report-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.report-summary-item,
.report-list-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 18px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.report-summary-label,
.report-field-label {
    display: block;
    margin-bottom: 8px;
    color: #64748b;
    font-size: 14px;
    line-height: 1.5;
}

.report-summary-value,
.report-field-value {
    color: #0f172a;
    font-weight: 700;
    line-height: 1.6;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.report-field-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.report-field-row {
    display: grid;
    grid-template-columns: minmax(120px, 180px) minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    padding: 10px 0;
}

.report-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.report-chip {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    background: #eef2ff;
    color: #4338ca;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.5;
    max-width: 100%;
    word-break: break-word;
}

.report-grid-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.report-list-card h4 {
    margin-bottom: 12px;
    color: #334155;
    font-size: 18px;
    line-height: 1.5;
}

.report-field-row + .report-field-row {
    margin-top: 0;
    border-top: 1px solid #e2e8f0;
}

.report-labeled-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.report-text-block {
    padding: 18px 20px;
    border-radius: 18px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.report-observation {
    color: #334155;
    font-size: 16px;
    line-height: 1.8;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.report-empty {
    color: #64748b;
    line-height: 1.7;
}

/* ====================================
   播放器页
   ==================================== */
#player-page {
    background: #000;
}

.player-wrapper {
    position: relative;
    width: min(95vw, 1280px);
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

#mainVideo {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    background: #000;
}

/* 选项覆盖层 */
.choice-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    z-index: 50;
    pointer-events: none; /* 默认不拦截点击 */
}

.choice-overlay.active {
    pointer-events: auto;
}

/* 选项按钮 */
.choice-button {
    position: relative;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    outline: none;
    pointer-events: auto;
    transition: transform 0.3s ease;
}

.choice-button:hover {
    transform: scale(1.05);
}

.choice-button:active {
    transform: scale(0.95);
}

/* 选项图片 */
.choice-image {
    display: block;
    object-fit: contain;
    border-radius: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

/* 放大状态 - 图片本身放大 */
.choice-image.zoomed {
    width: min(66vw, 760px);
    max-height: 66vh;
    animation: zoomIn 0.3s ease-out;
}

/* 正常状态 - 适合儿童点击 */
.choice-image.normal {
    width: clamp(180px, 22vw, 300px);
    max-height: 28vh;
    cursor: pointer;
    animation: zoomOut 0.3s ease-out;
}

.choice-image.normal:hover {
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.5);
}

/* 放大动画 */
@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 缩小动画 */
@keyframes zoomOut {
    from {
        opacity: 0;
        transform: scale(0.3);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ====================================
   开发者控件
   ==================================== */
.dev-controls {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    border-radius: 30px;
    z-index: 100;
    opacity: 0.85;
    transition: opacity 0.3s ease;
}

.dev-controls:hover {
    opacity: 1;
}

.dev-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s ease;
    white-space: nowrap;
}

.dev-btn:hover {
    transform: scale(1.05);
}

.dev-btn:active {
    transform: scale(0.95);
}

.dev-progress {
    width: 200px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.dev-progress::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.dev-progress::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.dev-time {
    color: white;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
    min-width: 100px;
    text-align: center;
}

/* ====================================
   全屏模式
   ==================================== */
.player-wrapper:fullscreen {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
}

.player-wrapper:fullscreen .choice-overlay {
    inset: 0;
}

.player-wrapper:fullscreen .dev-controls {
    bottom: 30px;
}

/* ====================================
   响应式适配
   ==================================== */
@media (max-width: 1024px) {
    .choice-image.normal {
        width: clamp(150px, 25vw, 250px);
        max-height: 25vh;
    }
    
    .choice-overlay {
        gap: 20px;
    }
    
    .dev-progress {
        width: 150px;
    }
}

@media (max-width: 768px) {
    .selector-container,
    .form-wrapper {
        width: 95vw;
        padding: 30px;
    }
    
    .player-wrapper {
        width: 100vw;
        border-radius: 0;
    }
    
    .choice-image.normal {
        width: clamp(120px, 30vw, 200px);
        max-height: 22vh;
    }
    
    .choice-overlay {
        gap: 15px;
        flex-wrap: wrap;
    }
    
    .dev-controls {
        gap: 8px;
        padding: 8px 15px;
    }
    
    .dev-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .dev-progress {
        width: 120px;
    }
    
    .dev-time {
        font-size: 11px;
        min-width: 80px;
    }

    #report-page.page.active {
        padding: 0;
    }

    .report-page-shell {
        padding: 16px 12px 72px;
    }

    .report-panel h2 {
        font-size: 26px;
        margin-bottom: 18px;
    }

    .report-toolbar-card,
    .report-placeholder,
    .report-section {
        padding: 18px;
        border-radius: 18px;
    }

    .report-form-grid,
    .report-button-row,
    .report-summary-grid,
    .report-grid-list {
        grid-template-columns: 1fr;
    }

    .report-button-row .submit-btn {
        width: 100%;
        min-height: 52px;
        font-size: 17px;
    }

    .report-field-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .report-status {
        text-align: center;
        font-size: 15px;
    }

    .report-section h3 {
        font-size: 20px;
    }

    .report-summary-value,
    .report-field-value,
    .report-observation,
    .report-placeholder {
        font-size: 15px;
    }
}

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

.ai-qiqi-avatar,
.qiqi-avatar,
.ai-avatar {
    animation: qiqiFloat 3s ease-in-out infinite;
    will-change: transform;
}

.ai-qiqi-avatar.speaking,
.qiqi-avatar.speaking,
.ai-avatar.speaking {
    animation-duration: 2.2s;
}

@media (prefers-reduced-motion: reduce) {
    .ai-qiqi-avatar,
    .qiqi-avatar,
    .ai-avatar {
        animation: none !important;
    }
}
