
/*
107教材资源-新视野互动课文

*/

.hnc-unit-reader-root {
    margin: 24px 0;
    padding: 20px;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    font-family: "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    color: #1f2937;
}

.hnc-unit-reader-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.hnc-unit-reader-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
}

.hnc-unit-reader-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* 主要控制按钮；重复声明背景和文字颜色以抵抗主题覆盖 */
.hnc-unit-reader-btn {
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid #4f6bff;
    background-color: #5b7cfa !important;
    background-image: linear-gradient(135deg, #5b7cfa 0%, #7f8dff 100%) !important;
    color: #ffffff !important;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
    box-shadow: 0 6px 14px rgba(91, 124, 250, 0.2);
}
.hnc-unit-reader-btn:focus,
.hnc-unit-reader-btn:focus-visible {
    outline: 2px solid rgba(91, 124, 250, 0.45);
    outline-offset: 2px;
}

.hnc-unit-reader-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 18px rgba(91, 124, 250, 0.28);
}

.hnc-unit-reader-progress {
    position: relative;
    flex: 1 1 180px;
    height: 8px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.hnc-unit-reader-progress span {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #38bdf8, #6366f1);
    border-radius: inherit;
    transition: width 0.3s ease;
}

.hnc-unit-reader-progress span::after {
    content: attr(data-label);
    position: absolute;
    right: 12px;
    top: -26px;
    font-size: 12px;
    color: #64748b;
}

.hnc-unit-reader-list {
    display: grid;
    gap: 16px;
}

.hnc-unit-reader-card {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 18px;
    background: #f8fafc;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.hnc-unit-reader-card.is-completed {
    border-color: #34d399;
    box-shadow: 0 6px 18px rgba(52, 211, 153, 0.25);
}

.hnc-unit-reader-card.collapsed .hnc-unit-reader-body {
    display: none;
}

.hnc-unit-reader-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.hnc-unit-reader-card-header h4 {
    margin: 0;
    font-size: 18px;
    color: #1e293b;
}

.hnc-unit-reader-card-tools {
    display: flex;
    gap: 8px;
}

.hnc-unit-reader-mini-btn {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background-color: #eef2ff !important;
    color: #1e293b !important;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.hnc-unit-reader-mini-btn:hover,
.hnc-unit-reader-mini-btn:focus-visible {
    background-color: #1d4ed8 !important;
    color: #ffffff !important;
    border-color: #1d4ed8;
    outline: none;
}

.hnc-unit-reader-mini-btn--mark {
    border-color: #34d399;
    background-color: #ecfdf5 !important;
    color: #047857 !important;
}

.hnc-unit-reader-card.is-completed .hnc-unit-reader-mini-btn--mark {
    background-color: #10b981 !important;
    color: #ffffff !important;
    border-color: #0f9f7b;
}

.hnc-unit-reader-card.is-completed .hnc-unit-reader-mini-btn--mark:hover,
.hnc-unit-reader-card.is-completed .hnc-unit-reader-mini-btn--mark:focus-visible {
    filter: brightness(0.95);
}

.hnc-unit-reader-audio {
    width: 100%;
    margin-bottom: 14px;
    border-radius: 10px;
    background: #ffffff;
}

.hnc-unit-reader-body {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.hnc-unit-reader-text {
    margin: 0 auto;
    padding: 20px 28px;
    border-radius: 16px;
    border: 1px solid #d2ddf1;
    background: linear-gradient(180deg, #ffffff 0%, #f7f9fd 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
    line-height: 1.85;
    font-size: 17px;
    letter-spacing: 0.01em;
    hyphens: auto;
    word-break: normal;
    max-width: 860px;
    text-align: justify;
    text-align-last: left;
}

.hnc-unit-reader-text.zh {
    display: none;
    color: #334155;
    background: linear-gradient(180deg, #f8fafc 0%, #eef3f8 100%);
}

.hnc-unit-reader-text.zh.visible,
.hnc-unit-reader-root.hnc-unit-reader-show-zh .hnc-unit-reader-text.zh {
    display: block;
}

.hnc-unit-reader-paragraph {
    margin: 0;
}

.hnc-unit-reader-paragraph + .hnc-unit-reader-paragraph {
    margin-top: 1.2em;
}

.hnc-unit-reader-text.zh .hnc-unit-reader-paragraph + .hnc-unit-reader-paragraph {
    margin-top: 1em;
}

.hnc-unit-reader-paragraph--short {
    text-align: left !important;
    text-align-last: left !important;
}

.hnc-unit-reader-keywords {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 14px;
}

.hnc-unit-reader-keywords-label {
    display: inline-block;
    font-weight: 600;
    color: #1d4ed8;
    margin-bottom: 8px;
}

.hnc-unit-reader-keywords-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hnc-unit-reader-keyword-btn {
    padding: 4px 10px;
    font-size: 13px;
    border-radius: 999px;
    border: 1px solid #94a3b8;
    background-color: #f8fafc !important;
    color: #1e293b !important;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.hnc-unit-reader-keyword-btn:hover,
.hnc-unit-reader-keyword-btn:focus-visible {
    background-color: #1d4ed8 !important;
    color: #ffffff !important;
    border-color: #1d4ed8;
    outline: none;
}

.hnc-unit-reader-keyword-detail {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px dashed #cbd5e1;
    background: #eff6ff;
    color: #1e293b;
    display: none;
    line-height: 1.6;
}

.hnc-unit-reader-keyword-detail.active {
    display: block;
}

.hnc-unit-reader-keyword-detail strong {
    display: block;
    margin-bottom: 4px;
    font-size: 15px;
}

.hnc-unit-reader-mini-btn--figure,
.hnc-unit-reader-mini-btn--figure-close {
    background-color: #ecfeff !important;
    border-color: #38bdf8;
    color: #0f172a !important;
}

.hnc-unit-reader-mini-btn--figure:hover,
.hnc-unit-reader-mini-btn--figure:focus-visible,
.hnc-unit-reader-mini-btn--figure-close:hover,
.hnc-unit-reader-mini-btn--figure-close:focus-visible {
    background-color: #0ea5e9 !important;
    border-color: #0ea5e9;
    color: #ffffff !important;
}

.hnc-unit-reader-figure {
    margin-top: 14px;
    padding: 12px;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hnc-unit-reader-figure-img {
    width: 100%;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.14);
}

.hnc-unit-reader-figure-caption {
    font-size: 13px;
    color: #475569;
}

.hnc-unit-reader-figure-actions {
    display: flex;
    justify-content: flex-end;
}

.hnc-unit-reader-keyword-audio {
    margin-top: 8px;
    width: 100%;
}

.hnc-unit-reader-empty {
    text-align: center;
    font-size: 16px;
    color: #64748b;
    padding: 40px 0;
}

@media (max-width: 768px) {
    .hnc-unit-reader-root {
        padding: 16px;
        border-radius: 12px;
    }

    .hnc-unit-reader-title {
        font-size: 18px;
    }

    .hnc-unit-reader-card {
        padding: 14px;
    }

    .hnc-unit-reader-text {
        font-size: 15px;
    }

    .hnc-unit-reader-controls {
        gap: 8px;
    }

.hnc-unit-reader-btn {
    font-size: 13px;
    padding: 6px 12px;
    }
}

/* === Annotation Highlights & Popover === */

.hnc-unit-reader-annotation {
    position: relative;
    display: inline;
    border-bottom: 1px dashed #64748b;
    cursor: pointer;
    padding: 0 2px;
    transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.hnc-unit-reader-annotation:hover,
.hnc-unit-reader-annotation:focus {
    color: #2563eb;
    border-bottom-color: #2563eb;
    background-color: rgba(37, 99, 235, 0.08);
    outline: none;
}

.hnc-unit-reader-annotation.is-active {
    color: #1d4ed8;
    border-bottom-color: #1d4ed8;
    background-color: rgba(29, 78, 216, 0.12);
}

.hnc-unit-reader-popover {
    position: fixed;
    z-index: 9999;
    max-width: 320px;
    padding: 12px 18px 16px 18px;
    max-height: calc(100vh - 96px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid #dbe3f0;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

.hnc-unit-reader-popover.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.hnc-unit-reader-popover::after {
    content: "";
    position: absolute;
    width: 12px;
    height: 12px;
    background: #ffffff;
    border-left: 1px solid #dbe3f0;
    border-top: 1px solid #dbe3f0;
    transform: rotate(45deg);
    z-index: -1;
}

.hnc-unit-reader-popover[data-placement="bottom"]::after {
    top: -6px;
    left: 24px;
}

.hnc-unit-reader-popover[data-placement="top"]::after {
    bottom: -6px;
    left: 24px;
    transform: rotate(225deg);
}

.hnc-unit-reader-popover-inner {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 14px;
    color: #1f2937;
    line-height: 1.6;
}

.hnc-unit-reader-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    cursor: grab;
    user-select: none;
}

.hnc-unit-reader-popover.is-dragging .hnc-unit-reader-popover-header {
    cursor: grabbing;
}

.hnc-unit-reader-popover-grip {
    flex: 1;
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, #c7d2fe 0%, #a5b4fc 100%);
}

.hnc-unit-reader-popover-close {
    flex: 0 0 auto;
    border: none;
    background: transparent;
    color: #475569;
    font-size: 18px;
    line-height: 1;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.hnc-unit-reader-popover-close:hover,
.hnc-unit-reader-popover-close:focus-visible {
    background: rgba(148, 163, 184, 0.2);
    color: #1d4ed8;
    outline: none;
}

.hnc-unit-reader-popover-close:active {
    background: rgba(148, 163, 184, 0.35);
}

.hnc-unit-reader-popover-copy {
    flex: 0 0 auto;
    border: 1px solid #d0d7ff;
    background: #eef2ff;
    color: #1d4ed8;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.hnc-unit-reader-popover-copy:hover,
.hnc-unit-reader-popover-copy:focus-visible {
    background: #dbeafe;
    border-color: #b9c6ff;
    transform: translateY(-1px);
    outline: none;
}

.hnc-unit-reader-popover-example {
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px dashed #e2e8f0;
}

.hnc-unit-reader-popover-example-en {
    margin: 0 0 6px;
    font-weight: 600;
    color: #0f172a;
}

.hnc-unit-reader-popover-example-zh {
    margin: 0;
    color: #1f2937;
}

.hnc-unit-reader-popover::-webkit-scrollbar {
    width: 6px;
}

.hnc-unit-reader-popover::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 999px;
}

.hnc-unit-reader-popover::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.7);
    border-radius: 999px;
}

.hnc-unit-reader-popover {
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.7) transparent;
}

.hnc-unit-reader-popover-term {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
}

.hnc-unit-reader-popover-note {
    color: #475569;
    font-style: italic;
}

.hnc-unit-reader-popover-title {
    font-weight: 600;
    color: #1d4ed8;
}

.hnc-unit-reader-popover-body {
    color: #1f2937;
}

.hnc-unit-reader-popover-question {
    margin-top: 4px;
    padding: 8px 10px;
    background: #eff6ff;
    border-radius: 10px;
    border-left: 3px solid #3b82f6;
    color: #1e3a8a;
}

.hnc-unit-reader-popover-hint {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hnc-unit-reader-popover-hint-btn {
    align-self: flex-start;
    border: 1px solid #93c5fd;
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    color: #ffffff;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.hnc-unit-reader-popover-hint-btn:hover,
.hnc-unit-reader-popover-hint-btn:focus-visible {
    box-shadow: 0 10px 18px rgba(59, 130, 246, 0.3);
    transform: translateY(-1px);
    outline: none;
}

.hnc-unit-reader-popover-hint-content {
    background: #f5f8ff;
    border: 1px solid #cfe0ff;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 13.5px;
    color: #1e293b;
    line-height: 1.6;
}

.hnc-unit-reader-popover-hint-content p {
    margin: 0;
}

.hnc-unit-reader-popover-hint-content p + p {
    margin-top: 6px;
}

.hnc-unit-reader-extensions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.hnc-unit-reader-extension {
    border: 1px solid #d8e3fb;
    border-radius: 14px;
    background: #f8faff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
    overflow: hidden;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.hnc-unit-reader-extension.is-expanded {
    border-color: #7c9bff;
    box-shadow: 0 8px 18px rgba(124, 155, 255, 0.18);
}

.hnc-unit-reader-extension-toggle {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 600;
    color: #1e3a8a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.hnc-unit-reader-extension-toggle::after {
    content: '＋';
    font-size: 16px;
    transition: transform 0.2s ease;
}

.hnc-unit-reader-extension.is-expanded .hnc-unit-reader-extension-toggle::after {
    content: '－';
}

.hnc-unit-reader-extension-panel {
    border-top: 1px solid #dbe7ff;
    padding: 12px 16px 14px 16px;
    background: linear-gradient(180deg, #fdfdff 0%, #f3f6ff 100%);
}

.hnc-unit-reader-extension-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hnc-unit-reader-extension-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: #1f2937;
    font-size: 14px;
    line-height: 1.7;
}

.hnc-unit-reader-extension-item-title {
    color: #1d4ed8;
}

.hnc-unit-reader-extension-item-detail {
    margin: 0;
}

@media (max-width: 480px) {
    .hnc-unit-reader-popover {
        max-width: calc(100vw - 24px);
        padding: 14px 16px;
        max-height: calc(100vh - 72px);
    }
}
