/**
 * 英语思维练习 - 星空主题
 */
#english-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100vh;
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transform: translateY(50px) scale(0.95);
    transition: all 0.8s cubic-bezier(0.19, 1, 0.22, 1);
    padding: 120px 24px 80px;
    box-sizing: border-box;
    overflow-y: auto;
}

#english-container.active-section {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    z-index: 990;
}

#english-container.eng-no-animate {
    transition: none !important;
}

.eng-panel {
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.eng-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.eng-header h2 {
    font-size: 1.5rem;
    font-weight: 300;
    letter-spacing: 2px;
    color: #fff;
    text-shadow: 0 0 12px rgba(162, 140, 255, 0.5);
}

.eng-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.eng-glass-card {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 22px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.eng-input-area {
    width: 100%;
    min-height: 88px;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    color: #fff;
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.eng-input-area:focus {
    border-color: #a28cff;
    box-shadow: 0 0 0 3px rgba(162, 140, 255, 0.2);
}

.eng-input-area::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.eng-result-box {
    margin-top: 18px;
    padding: 16px 18px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(110, 142, 251, 0.15), rgba(167, 119, 227, 0.15));
    border: 1px solid rgba(162, 140, 255, 0.25);
    min-height: 52px;
}

/* 三合一结果预览 */
.eng-result-preview {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.eng-result-preview.eng-result-empty {
    padding: 20px;
    border-radius: 12px;
    border: 1px dashed rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.2);
}

.eng-preview-placeholder {
    text-align: center;
    color: rgba(255, 255, 255, 0.35);
    font-style: italic;
    margin: 0;
}

.eng-preview-cn {
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font-size: 0.95rem;
    line-height: 1.5;
    border-left: 3px solid rgba(162, 140, 255, 0.6);
}

.eng-block {
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.25);
}

.eng-block-formal { border-left: 3px solid #a29bfe; }
.eng-block-casual { border-left: 3px solid #81ecec; }
.eng-block-analysis { border-left: 3px solid #ffeaa7; }

.eng-block-label {
    font-size: 0.72rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.55);
    display: flex;
    align-items: center;
    gap: 6px;
}

.eng-block-formal .eng-block-label { color: #c4b5fd; }
.eng-block-casual .eng-block-label { color: #81ecec; }
.eng-block-analysis .eng-block-label { color: #ffeaa7; }

.eng-block-text {
    font-size: 0.98rem;
    line-height: 1.55;
    color: #e8e4ff;
    word-break: break-word;
}

.eng-analysis-text {
    color: #ddd;
    font-size: 0.92rem;
}

.eng-result-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.eng-result-text {
    font-size: 1.15rem;
    color: #e8e4ff;
    line-height: 1.5;
    word-break: break-word;
}

.eng-result-text.empty {
    color: rgba(255, 255, 255, 0.35);
    font-style: italic;
    font-size: 0.95rem;
}

.eng-btn-row {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.eng-btn {
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.eng-btn-primary {
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    color: #fff;
    box-shadow: 0 4px 15px rgba(110, 142, 251, 0.35);
}

.eng-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(110, 142, 251, 0.5);
}

.eng-btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.eng-btn-ghost {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ddd;
}

.eng-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.eng-btn-close {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #aaa;
    padding: 8px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
}

.eng-btn-close:hover {
    color: #ff7675;
    border-color: rgba(255, 118, 117, 0.4);
}

.eng-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.eng-toolbar-btns {
    display: flex;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.eng-toolbar-btns .eng-btn-ghost {
    flex: 1;
    justify-content: center;
    white-space: nowrap;
}

.eng-search {
    flex: 1;
    min-width: 180px;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    color: #fff;
    outline: none;
}

.eng-search:focus {
    border-color: #a28cff;
}

/* 按日期分组 */
.eng-day-groups {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 520px;
    overflow-y: auto;
}

.eng-day-groups::-webkit-scrollbar {
    width: 6px;
}

.eng-day-groups::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.eng-day-group {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.04);
}

.eng-day-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.06);
    border: none;
    color: #fff;
    cursor: pointer;
    text-align: left;
    transition: background 0.25s;
}

.eng-day-header:hover {
    background: rgba(255, 255, 255, 0.1);
}

.eng-day-chevron {
    width: 18px;
    color: #a28cff;
    transition: transform 0.3s;
    flex-shrink: 0;
}

.eng-day-group.is-open .eng-day-chevron {
    transform: rotate(90deg);
}

.eng-day-title {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 600;
}

.eng-day-count {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.45);
    padding: 3px 10px;
    border-radius: 12px;
    background: rgba(162, 140, 255, 0.15);
}

.eng-day-body {
    display: none;
    padding: 8px 10px 12px;
    flex-direction: column;
    gap: 8px;
}

.eng-day-group.is-open .eng-day-body {
    display: flex;
}

/* 日期折叠时，内部句子一并隐藏 */
.eng-day-group:not(.is-open) .eng-item-body {
    display: none !important;
}

.eng-day-group:not(.is-open) .eng-item.is-open .eng-item-chevron {
    transform: none;
}

.eng-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 420px;
    overflow-y: auto;
}

.eng-list::-webkit-scrollbar {
    width: 6px;
}

.eng-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.eng-item {
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
    transition: border-color 0.25s;
}

.eng-item:hover {
    border-color: rgba(162, 140, 255, 0.25);
}

.eng-item-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    text-align: left;
}

.eng-item-chevron {
    width: 14px;
    color: rgba(255, 255, 255, 0.4);
    transition: transform 0.3s;
    flex-shrink: 0;
}

.eng-item.is-open .eng-item-chevron {
    transform: rotate(90deg);
}

.eng-item-time {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    min-width: 42px;
    flex-shrink: 0;
}

.eng-item-cn-preview {
    flex: 1;
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.eng-item-body {
    display: none;
    padding: 0 14px 14px 38px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.eng-item.is-open .eng-item-body {
    display: block;
}

.eng-item-cn-full {
    color: #fff;
    font-size: 0.92rem;
    margin: 12px 0 10px;
    line-height: 1.5;
    padding-left: 8px;
    border-left: 2px solid rgba(162, 140, 255, 0.5);
}

.eng-item-body .eng-block {
    margin-bottom: 8px;
}

.eng-item-body .eng-block:last-of-type {
    margin-bottom: 12px;
}

.eng-item-cn {
    color: #fff;
    font-size: 0.95rem;
    margin-bottom: 6px;
    line-height: 1.5;
}

.eng-item-en {
    color: #b8b0e8;
    font-size: 0.9rem;
    line-height: 1.45;
}

.eng-item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
}

.eng-item-actions {
    display: flex;
    gap: 8px;
}

.eng-item-actions button {
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    transition: color 0.2s, background 0.2s;
}

.eng-item-actions button:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.eng-item-actions .eng-del:hover {
    color: #ff7675;
}

.eng-empty-tip {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.9rem;
}

.eng-loading {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: #a28cff;
    border-radius: 50%;
    animation: eng-spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

@keyframes eng-spin {
    to { transform: rotate(360deg); }
}

.eng-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 12px 24px;
    background: rgba(20, 20, 40, 0.95);
    border: 1px solid rgba(162, 140, 255, 0.4);
    border-radius: 12px;
    color: #fff;
    font-size: 0.9rem;
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.35s;
}

.eng-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.eng-toast.error {
    border-color: rgba(255, 118, 117, 0.5);
    color: #ffb4b4;
}

/* 编辑弹窗 */
.eng-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
}

.eng-modal.active {
    display: flex;
}

.eng-modal-content {
    width: 90%;
    max-width: 560px;
    padding: 24px;
    background: rgba(68, 66, 84, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    position: relative;
}

.eng-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 1.5rem;
    color: #aaa;
    cursor: pointer;
    border: none;
    background: none;
}

.eng-modal-close:hover {
    color: #fff;
}

.eng-form-group {
    margin-bottom: 14px;
}

.eng-form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    color: #b2bec3;
}

/* ========== 听力练习 ========== */
.eng-listen-card {
    border: 1px solid rgba(129, 236, 236, 0.2);
    background: linear-gradient(135deg, rgba(129, 236, 236, 0.06), rgba(162, 140, 255, 0.06));
}

.eng-listen-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 1.05rem;
    color: #fff;
    font-weight: 500;
}

.eng-listen-title i {
    color: #81ecec;
    margin-right: 6px;
}

.eng-listen-badge {
    font-size: 0.7rem;
    padding: 3px 10px;
    border-radius: 12px;
    background: rgba(129, 236, 236, 0.15);
    color: #81ecec;
    white-space: nowrap;
}

.eng-listen-desc {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.45);
    margin: 0 0 14px;
    line-height: 1.5;
}

.eng-listen-options {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.eng-listen-opt {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 120px;
}

.eng-listen-opt span {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

.eng-listen-opt span em {
    font-style: normal;
    color: #81ecec;
}

.eng-listen-select {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    font-size: 0.85rem;
    outline: none;
}

.eng-listen-opt-speed input[type="range"] {
    width: 100%;
    margin-top: 4px;
}

.eng-listen-hint {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.9rem;
    line-height: 1.55;
    margin-bottom: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px dashed rgba(255, 255, 255, 0.08);
}

.eng-listen-hint i {
    color: #81ecec;
    margin-top: 3px;
    flex-shrink: 0;
}

.eng-listen-hint.is-playing i {
    animation: eng-pulse 1s ease infinite;
}

.eng-listen-toolbar {
    margin-bottom: 14px;
}

.eng-listen-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.eng-listen-controls-main {
    margin-bottom: 8px;
}

.eng-listen-controls .eng-btn {
    flex: 1;
    min-width: 100px;
    justify-content: center;
    font-size: 0.82rem;
    padding: 9px 12px;
}

.eng-btn-danger {
    background: rgba(255, 107, 107, 0.22) !important;
    border-color: rgba(255, 107, 107, 0.45) !important;
    color: #ffb8b8 !important;
}

.eng-listen-stage {
    min-height: 88px;
    padding: 14px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px dashed rgba(255, 255, 255, 0.1);
}

.eng-listen-stage-placeholder {
    margin: 0;
    text-align: center;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.28);
    line-height: 1.6;
    padding: 12px 8px;
}

@keyframes eng-pulse {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.15); }
}

.eng-listen-answer {
    margin-top: 4px;
}

.eng-listen-answer.is-hidden {
    display: none;
}

.eng-listen-answer-cn {
    font-size: 0.95rem;
    color: #fff;
    padding-left: 10px;
    border-left: 3px solid #a29bfe;
    margin-bottom: 12px;
    line-height: 1.5;
}

.eng-listen-answer-spoken {
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(129, 236, 236, 0.12);
    border: 1px solid rgba(129, 236, 236, 0.35);
    color: #e8fffe;
    font-size: 1rem;
    line-height: 1.55;
    margin-bottom: 8px;
}

.eng-listen-answer-other {
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.88rem;
    line-height: 1.45;
    margin-bottom: 8px;
}

.eng-listen-answer-tag {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 4px;
}

@media (max-width: 768px) {
    #english-container {
        padding: 88px 10px 140px;
        width: 100%;
        box-sizing: border-box;
        transition: opacity 0.35s ease, visibility 0.35s ease, transform 0.35s ease;
    }

    .eng-panel {
        max-width: 100%;
    }

    .eng-header h2 {
        font-size: 1.15rem;
    }

    .eng-glass-card {
        padding: 14px 12px;
        margin-bottom: 12px;
        border-radius: 12px;
    }

    .eng-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .eng-search {
        min-width: 0;
        width: 100%;
    }

    .eng-toolbar-btns {
        display: flex;
        flex-direction: row;
        gap: 8px;
        width: 100%;
    }

    .eng-toolbar-btns .eng-btn-ghost {
        flex: 1;
        min-width: 0;
        padding: 8px 6px;
        font-size: 0.78rem;
        justify-content: center;
    }

    .eng-toolbar-btns .eng-btn-ghost i {
        display: none;
    }

    .eng-day-groups {
        max-height: none;
    }

    .eng-day-header {
        padding: 12px 10px;
        gap: 8px;
    }

    .eng-day-title {
        font-size: 0.88rem;
    }

    .eng-day-body {
        padding: 6px 4px 10px;
    }

    /* 手机：取消左侧大缩进，句子占满宽度 */
    .eng-item-header {
        flex-wrap: wrap;
        align-items: flex-start;
        padding: 10px 8px;
        gap: 6px;
    }

    .eng-item-chevron {
        margin-top: 2px;
    }

    .eng-item-time {
        min-width: auto;
        font-size: 0.7rem;
        opacity: 0.7;
    }

    .eng-item-cn-preview {
        flex: 1 1 100%;
        width: 100%;
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        line-height: 1.45;
        padding-left: 22px;
    }

    .eng-item-body {
        padding: 8px 6px 12px 6px;
    }

    .eng-item-cn-full {
        margin-top: 4px;
        padding-left: 10px;
        font-size: 0.95rem;
    }

    .eng-block {
        padding: 12px 10px;
    }

    .eng-block-text {
        font-size: 1.02rem;
        line-height: 1.65;
        letter-spacing: 0.01em;
    }

    .eng-analysis-text {
        font-size: 0.9rem;
        line-height: 1.6;
    }

    .eng-preview-cn,
    .eng-result-preview .eng-block {
        padding-left: 10px;
        padding-right: 10px;
    }

    .eng-item-meta {
        flex-direction: column;
        align-items: flex-end;
        gap: 6px;
    }

    .eng-modal-content {
        width: 94%;
        max-height: 88vh;
        overflow-y: auto;
        padding: 18px 14px;
    }

    .eng-listen-options {
        flex-direction: column;
    }

    .eng-listen-options {
        gap: 10px;
    }

    .eng-listen-opt {
        min-width: calc(50% - 6px);
        flex: 0 0 calc(50% - 6px);
    }

    .eng-listen-opt-speed {
        flex: 1 1 100%;
    }

    .eng-listen-controls-main,
    .eng-listen-controls-sub {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .eng-listen-controls-main #eng-listen-start {
        grid-column: 1 / -1;
    }
}
