/* === style.css (清爽版 - 句子自动换行) === */

:root {
    --primary: #2979FF;
    --bg-grey: #F5F7FA;
    --text-main: #333;
    --green: #4CAF50;
}

body {
    margin: 0;
    font-family: "Comic Sans MS", -apple-system, sans-serif;
    background: var(--bg-grey);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    color: var(--text-main);
}

#main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    flex-direction: column;
    position: relative;
    height: 100%;
}

/* === 左侧：图片区 === */
#col-left {
    flex: 0 0 38%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border-bottom: 1px solid #eee;
    overflow: hidden;
    z-index: 20;
}

#scene-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

/* === 按钮样式 === */
.pill-btn {
    background: rgba(0, 0, 0, 0.65);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(4px);
    padding: 3px 9px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: 0.2s;
    white-space: nowrap;
    min-width: 28px;
    text-align: center;
}

.pill-btn:active {
    transform: scale(0.95);
    background: rgba(0, 0, 0, 0.9);
}

.pill-btn.active {
    background: var(--primary);
    border-color: var(--primary);
}

.play-btn {
    background: var(--green);
    color: white;
    border: none;
    padding: 4px 12px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.play-btn.playing {
    background: #E53935;
}

.back-btn-float {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border: 1px solid #ccc;
}

/* === 控制按钮布局 === */
#left-controls-stack {
    position: absolute;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: flex-start;
    bottom: 5px;
    left: 8px;
}

.control-row {
    display: flex;
    gap: 4px;
    align-items: center;
}

#group-actions {
    position: absolute;
    z-index: 100;
    display: flex;
    gap: 6px;
    align-items: center;
    bottom: 5px;
    right: 8px;
}

#pc-play-btn-wrapper {
    display: none;
}

/* === 电脑端适配 (大屏) === */
@media (min-width: 768px) {
    #main-container {
        flex-direction: row;
    }

    #col-left {
        flex: 0 0 400px;
        height: 100%;
        border-right: 1px solid #ddd;
        border-bottom: none;
    }

    #col-mid {
        flex: 1;
        border-right: 1px solid #ddd;
    }

    #col-right {
        flex: 0 0 300px;
        height: 100%;
        border-top: none;
    }

    .pill-btn {
        background: rgba(255, 255, 255, 0.9);
        color: #333;
        border: 1px solid #ddd;
        padding: 5px 10px;
        font-size: 12px;
    }

    .pill-btn.active {
        background: var(--primary);
        color: white;
    }

    .play-btn {
        background: var(--green);
        color: white;
    }

    #left-controls-stack {
        top: 20px;
        left: 20px;
        bottom: auto;
        gap: 10px;
    }

    #pc-play-btn-wrapper {
        display: block;
        margin-right: 8px;
    }

    #mobile-play-btn {
        display: none;
    }

    #group-actions {
        display: none;
    }
}

/* === PC端返回按钮 === */
#pc-back-btn {
    display: none;
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
}

@media (min-width: 768px) {
    #pc-back-btn {
        display: block;
    }
}

/* === 中间：剧本区 === */
#col-mid {
    flex: 1;
    background: var(--bg-grey);
    overflow-y: auto;
    padding: 15px;
    transition: flex 0.3s;
}

/* === 右侧：词汇区 === */
#col-right {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    background: white;
    border-top: 2px solid #FFD54F;
    z-index: 30;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.vocab-header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    background: #FFF8E1;
    border-bottom: 1px solid #FFE082;
    flex-shrink: 0;
    cursor: pointer;
}

.vocab-header-text {
    font-weight: bold;
    font-size: 14px;
    color: #5D4037;
    flex: 1;
    user-select: none;
}

.toggle-btn {
    background: white;
    border: 1px solid #FFCA28;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #F57C00;
    cursor: pointer;
    margin-left: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.vocab-list {
    display: none;
    height: 40vh;
    overflow-y: auto;
    padding: 10px;
    background: white;
    -webkit-overflow-scrolling: touch;
}

.vocab-list.expanded {
    display: block;
}

@media (min-width: 768px) {
    .vocab-list {
        display: block;
        height: auto;
        flex: 1;
    }

    .toggle-btn {
        display: flex;
    }
}

/* === 卡片与文字 === */
.script-card {
    background: white;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    border: 2px solid transparent;
    cursor: pointer;
    transition: 0.2s;
}

.script-card.active {
    border-color: var(--primary);
    background: #E3F2FD;
    transform: scale(1.02);
}

.en-text {
    font-size: 18px;
    font-weight: 500;
    line-height: 1.5;
    margin-bottom: 8px;
    color: #222;
}

.cn-text {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.highlight-word {
    color: #00897B;
    border-bottom: 2px solid #4DB6AC;
    font-weight: bold;
    cursor: pointer;
}

/* === 单词卡片 === */
.vocab-card {
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 8px;
    background: #fff;
    border-left: 4px solid #ddd;
    cursor: pointer;
}

.vocab-card.focused {
    border-left-color: #FF9800 !important;
    background-color: #FFF3E0 !important;
}

.vocab-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.vocab-word {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.vocab-mask {
    margin-top: 5px;
    font-size: 12px;
    color: #999;
    background: #f5f5f5;
    padding: 4px;
    text-align: center;
}

.vocab-reveal {
    display: none;
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid #f0f0f0;
    font-size: 14px;
}

.vocab-card.revealed .vocab-mask {
    display: none;
}

.vocab-card.revealed .vocab-reveal {
    display: block;
}

/* === 互动部分 === */
.section-divider {
    text-align: center;
    margin: 30px 0 20px 0;
    color: #888;
    font-size: 14px;
}

.quiz-card {
    background: #FFF3E0;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    border: 2px dashed #FFB74D;
}

.quiz-opt {
    background: white;
    border: 1px solid #FFCC80;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quiz-opt.correct {
    background: #C8E6C9;
    border-color: #4CAF50;
}

.quiz-opt.wrong {
    background: #FFCDD2;
    border-color: #F44336;
}

.quiz-opt::after {
    content: '';
    font-weight: bold;
    font-size: 18px;
    margin-left: 10px;
}

.quiz-opt.correct::after {
    content: '✅';
    color: #2E7D32;
}

.quiz-opt.wrong::after {
    content: '❌';
    color: #C62828;
}

.audio-btn {
    border: 1px solid var(--primary);
    background-color: white;
    color: var(--primary);
    border-radius: 6px;
    padding: 4px 10px;
    margin-left: 10px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: 0.2s;
}

/* === 弹窗 === */
#login-overlay,
#start-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#login-overlay {
    background: #2979FF;
}

#start-overlay {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
}

.login-box {
    background: white;
    padding: 30px;
    border-radius: 20px;
    width: 85%;
    max-width: 320px;
    text-align: center;
    color: #333;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.login-input {
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    border: 2px solid #eee;
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box;
    background: #f9f9f9;
    outline: none;
}

.login-btn {
    width: 100%;
    padding: 12px;
    background: #2979FF;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 15px;
}

.big-start-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 50px;
    font-size: 24px;
    font-weight: bold;
    box-shadow: 0 5px 20px rgba(76, 175, 80, 0.4);
    cursor: pointer;
}

/* ========================================= */
/* === V68 样式：无录音，句子自动换行 === */
/* ========================================= */

/* 1. 如果HTML里还有录音按钮，强制隐藏它 (为了保险起见) */
.record-btn {
    display: none !important;
}

/* 2. 句子点读样式 & 自动换行 */
.sentence-span {
    cursor: pointer;
    border-radius: 4px;
    padding: 4px 5px; /* 增加一点内边距，更好点 */
    transition: background-color 0.2s;
    
    /* ★ 核心修改：让每一句话独占一行 */
    display: block; 
    margin-bottom: 12px; /* 句子之间的空隙 */
    line-height: 1.6;
}

/* 鼠标悬停时：浅蓝色背景 */
.sentence-span:hover {
    background-color: #E3F2FD;
    box-shadow: 0 0 3px rgba(0,0,0,0.1);
}

/* 正在朗读时：浅黄色高亮 */
.sentence-span.sentence-playing {
    background-color: #FFF9C4;
    border-left: 4px solid #FBC02D; /* 左侧加个黄条提示 */
    padding-left: 8px;
}