/* ========================================
   互動教學元件樣式
   ======================================== */

/* ========================================
   連連看 - Matching Game
   ======================================== */
.matching-container {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: space-between;
    padding: 40px 60px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #dadce0;
}

.matching-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 180px;
}

.matching-item {
    padding: 14px 18px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid #dadce0;
    font-size: 15px;
    font-weight: 500;
    color: #1f1f1f;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    text-align: center;
    user-select: none;
    -webkit-user-drag: none;
}

.matching-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: #93c5fd;
}

.matching-item.selected {
    background: #4A7AE8;
    color: white;
    border-color: #4A7AE8;
    box-shadow: 0 2px 8px rgba(74, 122, 232, 0.3);
}

.matching-item.correct {
    background: #e6f4ea;
    color: #166534;
    border-color: #86efac;
}

.matching-item.incorrect {
    background: #fce8e6;
    color: #991b1b;
    border-color: #fca5a5;
    animation: shake 0.5s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-5px);
    }

    40%,
    80% {
        transform: translateX(5px);
    }
}

/* 連線 SVG */
.matching-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.matching-line {
    stroke: #4A7AE8;
    stroke-width: 2.5;
    stroke-linecap: round;
    fill: none;
    marker-end: url(#arrowhead);
}

.matching-line.correct {
    stroke: #1e8e3e;
    marker-end: url(#arrowhead-correct);
}

.matching-line.incorrect {
    stroke: #d93025;
    marker-end: url(#arrowhead-incorrect);
}

.matching-line.drawing {
    stroke: #4A7AE8;
    stroke-width: 3;
    stroke-dasharray: 8, 4;
    opacity: 0.7;
    animation: dash 0.4s linear infinite;
}

@keyframes dash {
    to {
        stroke-dashoffset: -10;
    }
}

/* 拖曳中的左側 item */
.matching-item.dragging {
    background: #4A7AE8;
    color: white;
    border-color: #4A7AE8;
    box-shadow: 0 8px 24px rgba(74, 122, 232, 0.4);
    transform: scale(1.05);
    z-index: 10;
}

/* 可放置的右側 item */
.matching-item.drop-target {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.3);
    animation: pulse-border 1.5s ease infinite;
}

@keyframes pulse-border {

    0%,
    100% {
        box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.2);
    }

    50% {
        box-shadow: 0 0 0 5px rgba(147, 197, 253, 0.4);
    }
}

/* 滑鼠懸停在右側 item 上 */
.matching-item.hovering {
    background: #eff6ff;
    border-color: #4A7AE8;
    box-shadow: 0 0 0 3px rgba(74, 122, 232, 0.3);
    transform: scale(1.05);
}

/* 配對圓點 */
.matching-dot {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #4A7AE8;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    z-index: 5;
}

.matching-dot.left {
    right: -7px;
    top: 50%;
    transform: translateY(-50%);
}

.matching-dot.right {
    left: -7px;
    top: 50%;
    transform: translateY(-50%);
}

/* ========================================
   排列順序 - Ordering Game
   ======================================== */
/* ── 排列順序 ── */
.ordering-container {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    gap: 28px;
    padding: 32px 36px 64px;
    background: #fafbfc;
    border-radius: 16px;
    border: 1px solid #dadce0;
    align-items: flex-start;
    overflow: hidden;
}

.ordering-container.all-correct {
    background: #f7faf8;
    border-color: #a7d5b8;
}

/* ── Source pool ── */
.ordering-source {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 100px;
    padding: 12px;
    border-radius: 12px;
    border: 2px dashed transparent;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ordering-source.drag-over-return {
    border-color: #93c5fd;
    background: rgba(147, 197, 253, 0.08);
}

.ordering-source-title,
.ordering-slots-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: #80868b;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

/* ── Chip ── */
.ordering-chip {
    padding: 11px 16px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
    border: 1.5px solid #dadce0;
    font-size: 13.5px;
    font-weight: 500;
    color: #1f1f1f;
    cursor: grab;
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.22s ease,
        border-color 0.22s ease,
        opacity 0.15s ease;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.ordering-chip:hover {
    
    box-shadow: 0 6px 20px rgba(74, 122, 232, 0.12);
    border-color: #93c5fd;
}

.ordering-chip:active,
.ordering-chip.dragging {
    cursor: grabbing;
    opacity: 0.4;
    transform: scale(0.96);
}

.ordering-chip.drag-hidden {
    opacity: 0.25;
}

.ordering-chip.locked {
    cursor: default;
    opacity: 0.85;
    pointer-events: none;
    background: #f5faf7;
    border-color: #c3ddd0;
}

/* 錯誤退回提示 — 柔和脈衝 */
.ordering-chip.return-hint {
    cursor: pointer;
    animation: return-pulse 1.6s ease-in-out infinite;
    border-color: #fca5a5;
}

.ordering-chip.return-hint::after {
    content: '↩';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: #d93025;
    opacity: 0.7;
}

@keyframes return-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(252, 165, 165, 0);
    }

    50% {
        box-shadow: 0 0 0 4px rgba(252, 165, 165, 0.25);
    }
}

/* ── Ghost (touch 拖曳) ── */
.ordering-ghost {
    position: fixed;
    pointer-events: none;
    z-index: 10000;
    padding: 11px 16px;
    background: linear-gradient(135deg, #4A7AE8, #1a73e8);
    color: white;
    border-radius: 10px;
    box-shadow: 0 12px 36px rgba(74, 122, 232, 0.35),
        0 0 0 3px rgba(74, 122, 232, 0.15);
    font-size: 13.5px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    transform: scale(1.04) rotate(-1deg);
    transition: transform 0.1s ease;
}

/* ── Chip icon badge ── */
.ordering-chip .chip-icon {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: #e8ecf1;
    color: #5a6577;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

/* ── Slots area ── */
.ordering-slots {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ordering-slot {
    min-height: 46px;
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.ordering-slot .slot-number {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: #f1f3f4;
    color: #80868b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-left: 8px;
    transition: all 0.25s ease;
}

/* ── Slot states ── */
.ordering-slot.drag-over {
    border-color: #4A7AE8;
    background: rgba(74, 122, 232, 0.06);
    border-style: solid;
    transform: scale(1.02);
    box-shadow: 0 0 0 3px rgba(74, 122, 232, 0.08);
}

.ordering-slot.correct {
    border-color: #8fc9a3;
    border-style: solid;
    background: #f5faf7;
}

.ordering-slot.correct .slot-number {
    background: #5ba37a;
    color: white;
}

.ordering-slot.incorrect {
    border-color: #f87171;
    border-style: solid;
    background: #fce8e6;
    animation: slot-shake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

.ordering-slot.incorrect .slot-number {
    background: #d93025;
    color: white;
}

.ordering-slot.locked {
    border-style: solid;
}

@keyframes slot-shake {

    0%,
    100% {
        transform: translateX(0);
    }

    15% {
        transform: translateX(-6px);
    }

    30% {
        transform: translateX(5px);
    }

    45% {
        transform: translateX(-4px);
    }

    60% {
        transform: translateX(3px);
    }

    75% {
        transform: translateX(-2px);
    }

    90% {
        transform: translateX(1px);
    }
}

/* Chip 放入 slot 內 */
.ordering-slot .ordering-chip {
    flex: 1;
    margin: 0;
    cursor: grab;
}

.ordering-slot.locked .ordering-chip {
    cursor: default;
}

/* ── Result banner ── */
.ordering-result {
    position: absolute;
    bottom: 12px;
    right: 24px;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 10;
    animation: result-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    white-space: nowrap;
}

@keyframes result-pop {
    0% {
        transform: scale(0.8);
        /* Removed translateX(-50%) */
        opacity: 0;
    }

    100% {
        transform: scale(1);
        /* Removed translateX(-50%) */
        opacity: 1;
    }
}

.ordering-result .material-symbols-outlined {
    font-size: 18px;
}

.ordering-result.success {
    background: #edf7f0;
    color: #2d6a4f;
    border: 1px solid #a7d5b8;
}

.ordering-result.error {
    background: #fef5f5;
    color: #8b3a3a;
    border: 1px solid #e8b4b4;
}

/* ── Confetti ── */
.ordering-confetti {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    pointer-events: none;
    z-index: 20;
    animation: confetti-burst 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes confetti-burst {
    0% {
        transform: translate(0, 0) rotate(0) scale(1);
        opacity: 1;
    }

    100% {
        transform: translate(var(--x), var(--y)) rotate(var(--r)) scale(0);
        opacity: 0;
    }
}

/* ========================================
   填空題 - Fill in the Blank
   ======================================== */
.fill-blank-container {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 36px 40px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #dadce0;
}

.fill-blank-title {
    font-size: 20px;
    font-weight: 600;
    color: #1f1f1f;
    margin-bottom: 20px;
    text-align: left;
}

.fill-blank-content {
    flex: 1;
    font-size: 17px;
    line-height: 2.4;
    color: #1f1f1f;
}

.fill-blank-input {
    display: inline-block;
    min-width: 90px;
    padding: 4px 14px;
    margin: 0 4px;
    border: 1.5px dashed #80868b;
    border-radius: 6px;
    background: white;
    font-size: inherit;
    font-family: inherit;
    color: #1f1f1f;
    text-align: center;
    transition: all 0.2s ease;
}

.fill-blank-input:focus {
    outline: none;
    border-style: solid;
    border-color: #4A7AE8;
    box-shadow: 0 0 0 2px rgba(74, 122, 232, 0.15);
}

.fill-blank-input.correct {
    border-color: #1e8e3e;
    background: #e6f4ea;
    color: #166534;
}

.fill-blank-input.incorrect {
    border-color: #d93025;
    background: #fce8e6;
    color: #991b1b;
    animation: shake 0.5s ease;
}

.fill-blank-check-btn {
    display: block;
    margin: 20px auto 0;
    padding: 8px 28px;
    background: #4A7AE8;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.fill-blank-check-btn:hover {
    background: #3b6ad4;
    box-shadow: 0 2px 8px rgba(74, 122, 232, 0.3);
}

.fill-blank-result {
    text-align: center;
    margin-top: 16px;
    font-size: 18px;
    font-weight: 600;
}

.fill-blank-result.success {
    color: #1e8e3e;
}

.fill-blank-result.error {
    color: #d93025;
}

/* ========================================
   複製文字卡片 - Copy Card
   ======================================== */
.copy-card-container {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 20px 24px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #dadce0;
}

.copy-card-title {
    font-size: 13px;
    font-weight: 600;
    color: #444746;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.copy-card-title::before {
    content: '';
}

.copy-card-content {
    flex: 1;
    padding: 16px 18px;
    background: white;
    border-radius: 8px;
    border: 1px solid #dadce0;
    font-size: 14px;
    line-height: 1.7;
    color: #1f1f1f;
    font-family: 'SF Mono', 'Fira Code', 'Noto Sans TC', monospace;
    word-break: break-all;
    overflow-y: auto;
    user-select: text;
}

.copy-card-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 14px;
    background: #444746;
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.copy-card-btn:hover {
    background: #1f1f1f;
}

.copy-card-btn.copied {
    background: #1e8e3e;
}

.copy-card-btn .copy-icon {
    font-size: 14px;
}

.copy-card-feedback {
    text-align: right;
    margin-top: 6px;
    font-size: 12px;
    font-weight: 500;
    min-height: 16px;
}

.copy-card-feedback.success {
    color: #1e8e3e;
}

.copy-card-feedback.error {
    color: #d93025;
}

/* ── 複製卡片變數輸入 ── */
.cc-var-input {
    display: inline-block;
    min-width: 90px;
    max-width: 180px;
    padding: 4px 14px;
    margin: 2px 4px;
    border: 1.5px solid #c4b5fd;
    background: rgba(139, 92, 246, 0.06);
    border-radius: 20px;
    font-size: inherit;
    font-family: inherit;
    color: #5b21b6;
    font-weight: 600;
    text-align: center;
    transition: all 0.25s ease;
    vertical-align: baseline;
    line-height: 1.4;
}

.cc-var-input::placeholder {
    color: #8ab4f8;
    font-weight: 500;
    font-style: normal;
    font-size: 0.9em;
}

.cc-var-input:focus {
    outline: none;
    border-color: #1a73e8;
    background: rgba(139, 92, 246, 0.1);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.12), 0 2px 8px rgba(139, 92, 246, 0.1);
}

.cc-var-input:not(:placeholder-shown) {
    border-color: #1e8e3e;
    background: rgba(34, 197, 94, 0.06);
    color: #166534;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.1);
}

.cc-var-hint {
    font-size: 11px;
    color: #4285f4;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 6px;
    font-weight: 500;
    opacity: 0.8;
}

.cc-var-hint::before {
    content: '⚠';
}

.copy-card-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(0.3);
}

/* ========================================
   複製卡片功能
   ======================================== */
.copy-overlay {
    position: absolute;
    inset: 0;
    background: rgba(26, 115, 232, 0.1);
    border: 3px dashed #1a73e8;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.editable-element:hover .copy-overlay.active {
    opacity: 1;
}

.copy-badge {
    padding: 8px 16px;
    background: #1a73e8;
    color: white;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* 選取多個元素的範圍框 */
.selection-box {
    position: absolute;
    border: 2px dashed #1a73e8;
    background: rgba(26, 115, 232, 0.1);
    pointer-events: none;
    z-index: 100;
}

/* 複製成功提示 */
.copy-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 12px 24px;
    background: #1e8e3e;
    color: white;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.4);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 2000;
}

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

/* ========================================
   編輯模式下的互動元件樣式
   ======================================== */
.interactive-element {
    position: absolute;
    border: 2px solid transparent;
    border-radius: 16px;
    transition: border-color 0.2s ease;
}

.interactive-element:hover {
    border-color: var(--accent-secondary);
}

.interactive-element.selected {
    border-color: var(--accent-secondary);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.2);
}

/* 互動元件類型標籤 */
.interactive-label {
    position: absolute;
    top: -28px;
    left: 0;
    padding: 4px 12px;
    background: var(--accent-secondary);
    color: white;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px 4px 0 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 分數徽章 — 固定在互動元件右上角（框內）— 目前隱藏避免遮擋內容 */
.element-score-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 10;
    display: none; /* 隱藏分數提示，分數機制仍正常運作 */
    align-items: center;
    gap: 3px;
    padding: 2px 8px 2px 6px;
    background: linear-gradient(135deg, #f9ab00, #e37400);
    color: white;
    font-size: 11px;
    font-weight: 700;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.4);
    white-space: nowrap;
    pointer-events: none;
    line-height: 1.4;
}

/* ========================================
   互動元件自訂外觀（由屬性面板 CSS vars 控制）
   ======================================== */
/* 標題字級 */
.interactive-element .quiz-question,
.interactive-element .poll-question,
.interactive-element .matching-header,
.interactive-element .fill-blank-title,
.interactive-element .copy-card-title,
.interactive-element .scale-question,
.interactive-element .buzzer-question,
.interactive-element .wc-question,
.interactive-element .hs-question,
.interactive-element .tf-question,
.interactive-element .ot-question {
    font-size: var(--ia-title-fs, 18px) !important;
}

/* 選項字級 */
.interactive-element .quiz-option,
.interactive-element .poll-option,
.interactive-element .matching-item,
.interactive-element .ordering-chip,
.interactive-element .ordering-slot,
.interactive-element .fill-blank-content,
.interactive-element .copy-card-content,
.interactive-element .tf-option,
.interactive-element .ot-textarea {
    font-size: var(--ia-option-fs, 15px) !important;
}

/* 內距 */
.interactive-element .quiz-container,
.interactive-element .poll-container,
.interactive-element .matching-container,
.interactive-element .fill-blank-container,
.interactive-element .copy-card-container,
.interactive-element .ordering-container,
.interactive-element .scale-container,
.interactive-element .buzzer-container,
.interactive-element .wc-container,
.interactive-element .hs-container,
.interactive-element .tf-container,
.interactive-element .ot-container {
    padding: var(--ia-padding, 16px) !important;
}

/* ========================================
   互動元件編輯面板
   ======================================== */
.interactive-editor {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.pair-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.pair-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    min-width: 0;
}

.pair-item input {
    flex: 1;
    min-width: 0;
    padding: 5px 6px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.72rem;
}

.pair-item .pair-arrow {
    color: var(--text-muted);
    font-size: 0.85rem;
    flex-shrink: 0;
}

.pair-item .remove-pair {
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    color: var(--accent-danger);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.2s ease;
    flex-shrink: 0;
    font-size: 0.7rem;
}

.pair-item .remove-pair:hover {
    background: rgba(217, 48, 37, 0.1);
}

.add-pair-btn {
    padding: var(--spacing-sm);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.add-pair-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* 填空題編輯 */
.blank-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.blank-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.blank-item .blank-number {
    width: 24px;
    height: 24px;
    background: var(--accent-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
}

/* ========================================
   動畫效果
   ======================================== */
@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-pulse {
    animation: pulse 2s infinite;
}

.animate-bounce {
    animation: bounce 1s infinite;
}

.animate-fadeIn {
    animation: fadeIn 0.3s ease;
}

/* ========================================
   作品展示牆 - Showcase
   ======================================== */

/* 作業牆容器 */
.showcase-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: visible;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #dadce0;
    /* 強制 GPU compositing（修復 iOS Safari 在 transform:scale 內不渲染 overflow 子元素） */
    will-change: transform;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* 編輯模式 placeholder */
.showcase-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: #f8f9fa;
    border: 1px solid #dadce0;
    border-radius: 10px;
    gap: 4px;
    color: #444746;
}

/* 載入中 */
.showcase-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 100%;
    color: #444746;
    font-size: 0.9rem;
}

.showcase-spin {
    animation: spin 1s linear infinite;
}

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

/* Header bar */
.showcase-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: #1f1f1f;
    color: #f1f3f4;
    border-radius: 8px 8px 0 0;
    flex-shrink: 0;
    -webkit-transform: translateZ(0);
}

.showcase-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.showcase-header-title {
    font-weight: 600;
    font-size: 0.9rem;
}

.showcase-header-count {
    background: rgba(255, 255, 255, 0.12);
    padding: 3px 12px;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 500;
}

.showcase-header-pending {
    color: #fbbf24;
    font-weight: 600;
    margin-left: 4px;
}

/* Status chips row */
.showcase-status-row {
    display: flex;
    gap: 6px;
    padding: 8px 16px;
    background: #f8f9fa;
    overflow-x: auto;
    flex-shrink: 0;
    border-bottom: 1px solid #dadce0;
}

.showcase-status-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px 3px 3px;
    border-radius: 16px;
    font-size: 0.75rem;
    white-space: nowrap;
    flex-shrink: 0;
    background: #f1f3f4;
    color: #1f1f1f;
    border: 1px solid #dadce0;
}

.showcase-chip-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #444746;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 600;
}

.showcase-chip-name {
    font-weight: 500;
}

/* Horizontal scroll gallery (default) */
.showcase-grid {
    display: flex;
    gap: 14px;
    padding: 12px 16px;
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    background: #fff;
    border-radius: 0 0 8px 8px;
    -webkit-overflow-scrolling: touch;
    -webkit-transform: translateZ(0);
}

/* ── 宮格模式共用 ── */
.showcase-grid.grid-mode {
    display: grid;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 10px;
    gap: 8px;
    align-content: start;
}

.showcase-grid.grid-3 { grid-template-columns: repeat(3, 1fr); }
.showcase-grid.grid-4 { grid-template-columns: repeat(4, 1fr); }

.showcase-grid.grid-mode .showcase-work-card {
    flex: none;
    max-width: none;
    width: 100%;
}

.showcase-grid.grid-mode .showcase-work-body {
    max-height: 120px;
    overflow: hidden;
}

.showcase-grid.grid-mode .showcase-preview-img {
    max-height: 100px;
    object-fit: cover;
}

/* ── 模式切換按鈕組 ── */
.showcase-view-toggle {
    display: flex;
    gap: 2px;
    margin-left: 8px;
    background: rgba(255,255,255,0.08);
    border-radius: 6px;
    padding: 2px;
}

.showcase-view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 24px;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.45);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
    font-size: 0;
}

.showcase-view-btn .material-symbols-outlined {
    font-size: 16px;
}

.showcase-view-btn:hover {
    color: rgba(255,255,255,0.8);
    background: rgba(255,255,255,0.1);
}

.showcase-view-btn.active {
    color: #fff;
    background: rgba(255,255,255,0.18);
}

.showcase-grid::-webkit-scrollbar {
    height: 6px;
}

.showcase-grid::-webkit-scrollbar-track {
    background: #f1f3f4;
    border-radius: 3px;
}

.showcase-grid::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.showcase-grid::-webkit-scrollbar-thumb:hover {
    background: #80868b;
}

.showcase-empty {
    width: 100%;
    text-align: center;
    color: #80868b;
    padding: 40px;
    font-size: 0.88rem;
}

/* Work cards — fixed width, vertical scroll inside */
.showcase-work-card {
    flex: 0 0 280px;
    max-width: 280px;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #dadce0;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    display: flex;
    flex-direction: column;
}

.showcase-work-card:hover {
    
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.showcase-work-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #f8f9fa;
    border-bottom: 1px solid #f1f3f4;
    flex-shrink: 0;
}

.showcase-work-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #444746, #1f1f1f);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
}

.showcase-work-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1f1f1f;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.showcase-work-body {
    padding: 10px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    max-height: 320px;
}

/* Preview types */
.showcase-preview-text {
    font-size: 0.82rem;
    color: #444746;
    line-height: 1.5;
    text-align: left;
    word-break: break-word;
    white-space: pre-wrap;
}

.showcase-preview-img {
    width: 100%;
    max-height: 180px;
    border-radius: 8px;
    object-fit: cover;
}

.showcase-preview-prompt {
    padding: 8px 10px;
    background: #f0f4ff;
    border-radius: 8px;
    border: 1px solid #d2e3fc;
}

.showcase-preview-icon {
    text-align: center;
    font-size: 0.82rem;
    line-height: 1.6;
    color: #444746;
}

.showcase-preview-icon .material-symbols-outlined {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 2px;
}

.showcase-preview-link {
    font-size: 0.75rem;
    color: #444746;
    word-break: break-all;
}

.showcase-preview-link a {
    color: #1f1f1f;
    text-decoration: underline;
    text-decoration-color: #cbd5e1;
    text-underline-offset: 2px;
}

.showcase-preview-link a:hover {
    text-decoration-color: #444746;
}

.showcase-preview-score {
    text-align: center;
}

.showcase-preview-score .score-big {
    font-size: 1.6rem;
    font-weight: 700;
    color: #1f1f1f;
    display: block;
}

.showcase-preview-score.perfect .score-big {
    color: #1e8e3e;
}

.showcase-preview-score .score-label {
    font-size: 0.7rem;
    color: #80868b;
}

/* ── 星級評分列 ── */
.showcase-score-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid #f1f3f4;
    background: #fafbfc;
}

.showcase-score-stars {
    display: flex;
    gap: 2px;
}

.showcase-star-btn {
    background: none;
    border: none;
    padding: 2px;
    cursor: pointer;
    color: #d1d5db;
    transition: color 0.15s, transform 0.15s;
    line-height: 1;
}

.showcase-star-btn .material-symbols-outlined {
    font-size: 20px;
    font-variation-settings: 'FILL' 0;
}

.showcase-star-btn:hover {
    color: #f9ab00;
    transform: scale(1.15);
}

.showcase-star-btn:hover ~ .showcase-star-btn {
    color: #d1d5db;
}

.showcase-score-stars:hover .showcase-star-btn {
    color: #f9ab00;
}

.showcase-score-stars:hover .showcase-star-btn:hover ~ .showcase-star-btn {
    color: #d1d5db;
}

.showcase-star-btn.filled {
    color: #f9ab00;
}

.showcase-star-btn.filled .material-symbols-outlined,
.showcase-star-btn.half .material-symbols-outlined {
    font-variation-settings: 'FILL' 1;
}

.showcase-star-btn.half {
    color: #fbbf24;
}

.showcase-score-value {
    font-size: 12px;
    font-weight: 600;
    color: #f9ab00;
    min-width: 30px;
}

.showcase-score-saved {
    font-size: 11px;
    color: #1e8e3e;
    font-weight: 500;
}

/* ── 學員端評分展示 ── */
.showcase-score-display {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-top: 1px solid #f1f3f4;
    background: #fffbeb;
    font-size: 12px;
    font-weight: 600;
    color: #b45309;
}

.showcase-score-display .material-symbols-outlined {
    font-size: 14px;
    color: #f9ab00;
    font-variation-settings: 'FILL' 1;
}

/* ── 互評投票 ── */
.showcase-peer-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-top: 1px solid #f1f3f4;
    background: #fafafa;
}

.showcase-vote-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 28px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    color: #cbd5e1;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}

.showcase-vote-btn .material-symbols-outlined {
    font-size: 16px;
    font-variation-settings: 'FILL' 0;
}

.showcase-vote-btn:hover:not(:disabled) {
    border-color: #fca5a5;
    color: #ef4444;
    background: #fef2f2;
}

.showcase-vote-btn.voted {
    border-color: #ef4444;
    color: #ef4444;
    background: #fef2f2;
}

.showcase-vote-btn.voted .material-symbols-outlined {
    font-variation-settings: 'FILL' 1;
}

.showcase-vote-btn.is-mine {
    opacity: 0.35;
    cursor: not-allowed;
}

.showcase-vote-btn:disabled:not(.is-mine):not(.voted) {
    opacity: 0.4;
    cursor: not-allowed;
}

.showcase-peer-count {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    min-width: 14px;
}

.showcase-votes-remaining {
    font-size: 12px;
    font-weight: 600;
    color: #f59e0b;
    padding: 2px 10px;
    background: rgba(245,158,11,0.12);
    border-radius: 4px;
    margin-left: 6px;
    white-space: nowrap;
}

.showcase-settle-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 12px;
    border: 1.5px solid #a78bfa;
    border-radius: 6px;
    background: rgba(167,139,250,0.08);
    color: #7c3aed;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    margin-left: 6px;
    font-family: inherit;
    white-space: nowrap;
}

.showcase-settle-btn:hover {
    background: rgba(167,139,250,0.18);
    border-color: #7c3aed;
}

.showcase-settle-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.showcase-settle-summary {
    padding: 12px 16px;
    background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
    border-bottom: 1px solid #bbf7d0;
    flex-shrink: 0;
}

/* ========================================
   展示聚焦 Overlay
   ======================================== */
.showcase-focus-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.showcase-focus-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.showcase-focus-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.showcase-focus-card {
    position: relative;
    background: #fff;
    border-radius: 12px;
    width: min(560px, 90vw);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
    animation: showcaseFocusIn 0.25s ease;
}

@keyframes showcaseFocusIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.showcase-focus-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #dadce0;
    flex-shrink: 0;
}

.showcase-focus-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.showcase-focus-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #1f1f1f;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 600;
}

.showcase-focus-user h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1f1f1f;
    margin: 0;
}

.showcase-focus-user span {
    font-size: 0.78rem;
    color: #80868b;
}

.showcase-focus-counter {
    font-size: 0.82rem;
    color: #444746;
    font-weight: 500;
}

.showcase-focus-body {
    padding: 24px 20px;
    min-height: 100px;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.showcase-full-text {
    font-size: 1rem;
    line-height: 1.7;
    color: #1f1f1f;
    white-space: pre-wrap;
}

.showcase-full-img {
    max-width: 100%;
    border-radius: 8px;
}

.showcase-full-video {
    width: 100%;
    border-radius: 8px;
}

.showcase-full-audio {
    text-align: center;
    padding: 20px;
    color: #444746;
}

.showcase-full-audio audio {
    margin-top: 12px;
    width: 100%;
}

.showcase-full-link {
    text-align: center;
    padding: 20px;
}

.showcase-full-link a {
    color: #1f1f1f;
    font-size: 1rem;
    word-break: break-all;
    text-decoration: underline;
    text-decoration-color: #cbd5e1;
}

.showcase-full-score {
    text-align: center;
    padding: 30px;
}

.showcase-full-score .score-value {
    font-size: 3.5rem;
    font-weight: 800;
    color: #1f1f1f;
}

.showcase-full-score.perfect .score-value {
    color: #1e8e3e;
}

.showcase-full-score .score-detail {
    font-size: 0.9rem;
    color: #80868b;
    margin-top: 8px;
}

/* Focus nav */
.showcase-focus-nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px 16px;
    border-top: 1px solid #dadce0;
    flex-shrink: 0;
}

.showcase-focus-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 18px;
    border: 1px solid #dadce0;
    border-radius: 6px;
    background: #fff;
    font-size: 0.82rem;
    font-family: inherit;
    color: #444746;
    cursor: pointer;
    transition: all 0.15s;
}

.showcase-focus-btn:hover:not(:disabled) {
    background: #f1f3f4;
    border-color: #cbd5e1;
}

.showcase-focus-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.showcase-focus-btn.close {
    background: #1f1f1f;
    color: #fff;
    border-color: #1f1f1f;
}

.showcase-focus-btn.close:hover {
    background: #1f1f1f;
}

/* Error */
.showcase-error {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 100%;
    color: #c5221f;
    font-size: 0.88rem;
}

/* ========================================
   選擇題 - Quiz
   ======================================== */
.quiz-container {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 28px 36px;
    background: #fafbfc;
    border-radius: 16px;
    border: 1px solid #dadce0;
    overflow: hidden;
}

.quiz-question {
    font-size: 1.05rem;
    font-weight: 600;
    color: #1f1f1f;
    margin-bottom: 16px;
    line-height: 1.5;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    overflow-y: auto;
}

.quiz-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    border: 1.5px solid #dadce0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    color: #1f1f1f;
    user-select: none;
}

.quiz-option:hover {
    border-color: #93c5fd;
    background: #f8faff;
}

.quiz-option .option-marker {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: #f1f3f4;
    color: #444746;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.quiz-option.selected {
    border-color: #60a5fa;
    background: #eff6ff;
}

.quiz-option.selected .option-marker {
    background: #3b82f6;
    color: white;
}

.quiz-option.correct-answer {
    border-color: #86efac;
    background: #e6f4ea;
    pointer-events: none;
}

.quiz-option.correct-answer .option-marker {
    background: #1e8e3e;
    color: white;
}

.quiz-option.wrong-answer {
    border-color: #fca5a5;
    background: #fce8e6;
    pointer-events: none;
}

.quiz-option.wrong-answer .option-marker {
    background: #d93025;
    color: white;
}

.quiz-option.missed-answer {
    border-color: #fde68a;
    background: #fef7e0;
    pointer-events: none;
}

.quiz-option.missed-answer .option-marker {
    background: #f9ab00;
    color: white;
}

.quiz-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    gap: 12px;
}

.quiz-result {
    font-size: 0.85rem;
    font-weight: 600;
    min-height: 20px;
}

.quiz-result.success {
    color: #1e8e3e;
}

.quiz-result.error {
    color: #c5221f;
}

.quiz-submit {
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    background: #3b82f6;
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.quiz-submit:hover {
    background: #2563eb;
}

.quiz-submit:disabled {
    opacity: 0.5;
    cursor: default;
}

.quiz-retry {
    display: none;
    padding: 6px 14px;
    border: 1.5px solid #dadce0;
    border-radius: 8px;
    background: white;
    color: #444746;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.quiz-retry:hover {
    border-color: #80868b;
    background: #f8f9fa;
}

/* ========================================
   投票 - Poll
   ======================================== */
.poll-container {
    background: #f8f9fa;
    border-radius: 16px;
    padding: 20px 20px;
    border: 1px solid #dadce0;
}

.poll-question {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1f1f1f;
    margin-bottom: 14px;
}

.poll-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.poll-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1.5px solid #dadce0;
    border-radius: 10px;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
    z-index: 1;
}

.poll-option:hover {
    border-color: #1a73e8;
    background: #f5f3ff;
}

.poll-option .option-marker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #f1f3f4;
    color: #444746;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
    z-index: 2;
    position: relative;
}

.poll-option .poll-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, rgba(26, 115, 232, 0.12) 0%, rgba(26, 115, 232, 0.06) 100%);
    border-radius: 12px;
    transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 0;
    width: 0;
}

.poll-option .poll-pct {
    margin-left: auto;
    font-size: 0.85rem;
    font-weight: 600;
    color: #1a73e8;
    white-space: nowrap;
    z-index: 2;
    position: relative;
}

.poll-option.poll-selected {
    border-color: #1a73e8;
    background: #f5f3ff;
}

.poll-option.poll-selected .option-marker {
    background: #1a73e8;
    color: #ffffff;
}

.poll-option.poll-selected .poll-bar {
    background: linear-gradient(90deg, rgba(26, 115, 232, 0.2) 0%, rgba(26, 115, 232, 0.08) 100%);
}

.poll-voted .poll-option {
    cursor: default;
}

.poll-voted .poll-option:hover {
    border-color: #dadce0;
    background: #ffffff;
}

.poll-voted .poll-option.poll-selected:hover {
    border-color: #1a73e8;
    background: #f5f3ff;
}

.poll-status {
    text-align: center;
    margin-top: 16px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #1e8e3e;
}

.poll-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #dadce0;
}

.poll-total {
    font-size: 0.85rem;
    color: #444746;
}

/* ========================================
   倒數計時器 - Countdown
   ======================================== */
.countdown-timer {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    pointer-events: none;
}

.countdown-ring {
    position: relative;
    width: 120px;
    height: 120px;
}

.countdown-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.countdown-bg {
    fill: none;
    stroke: #dadce0;
    stroke-width: 4;
}

.countdown-progress {
    fill: none;
    stroke: #3b82f6;
    stroke-width: 4;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.8s ease, stroke 0.3s;
}

.countdown-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.8rem;
    font-weight: 800;
    color: #1f1f1f;
    letter-spacing: -0.02em;
}

.countdown-urgent .countdown-progress {
    stroke: #f9ab00;
}

.countdown-urgent .countdown-text {
    color: #b45309;
}

.countdown-critical .countdown-progress {
    stroke: #d93025;
}

.countdown-critical .countdown-text {
    color: #c5221f;
    animation: countdown-pulse 1s ease infinite;
}

@keyframes countdown-pulse {
    50% {
        opacity: 0.4;
    }
}

.countdown-ended {
    opacity: 0.4;
}

.countdown-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    z-index: 30;
    font-size: 1.1rem;
    font-weight: 600;
    color: #444746;
    border-radius: inherit;
    animation: countdown-fadeIn 0.3s ease;
}

@keyframes countdown-fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ========================================
   互動元件 Mobile RWD
   ======================================== */
@media (max-width: 600px) {

    /* 連連看 */
    .matching-container {
        padding: 16px;
    }

    .matching-columns {
        gap: 20px;
    }

    .matching-item {
        padding: 8px 10px;
        font-size: 0.78rem;
    }

    /* 填空題 */
    .fillblank-container {
        padding: 16px;
    }

    .fillblank-sentence {
        font-size: 0.9rem;
    }

    .fillblank-input {
        min-width: 60px;
        font-size: 0.85rem;
    }

    /* 排序 */
    .ordering-container {
        padding: 16px;
        position: relative;
        height: auto !important;
        max-height: none !important;
        overflow: visible;
        flex-direction: column;
        gap: 16px;
    }

    .ordering-slot {
        font-size: 0.8rem;
    }

    .ordering-chip {
        font-size: 0.8rem;
        padding: 6px 10px;
    }

    .ordering-source,
    .ordering-slots {
        width: 100%;
        flex: none;
    }

    /* 選擇題 */
    .quiz-container {
        padding: 16px 20px;
    }

    .quiz-question {
        font-size: 0.9rem;
    }

    .quiz-option {
        padding: 10px 12px;
        font-size: 0.82rem;
    }

    .quiz-option .option-marker {
        width: 20px;
        height: 20px;
        font-size: 0.65rem;
    }

    .quiz-submit {
        padding: 6px 14px;
        font-size: 0.8rem;
    }

    /* 倒數計時器 */
    .countdown-ring {
        width: 80px;
        height: 80px;
    }

    .countdown-text {
        font-size: 1.3rem;
    }
}

/* ========================================
   通用重新作答按鈕
   ======================================== */
.interactive-reset-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 20;
    display: none;
    align-items: center;
    gap: 3px;
    padding: 4px 10px;
    border: 1px solid #dadce0;
    border-radius: 20px;
    background: white;
    color: #444746;
    font-size: 11px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.interactive-reset-btn .material-symbols-outlined {
    font-size: 14px;
}

.interactive-reset-btn:hover {
    background: #f1f3f4;
    color: #1f1f1f;
    border-color: #cbd5e1;
}

.interactive-reset-btn.visible {
    display: flex;
}

/* ========================================
   是非題 - True/False
   ======================================== */
.truefalse-container {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 12px 24px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #dadce0;
    overflow: hidden;
}

.tf-question {
    font-size: 20px;
    font-weight: 700;
    color: #1f1f1f;
    text-align: center;
    margin-bottom: 16px;
    line-height: 1.4;
}

.tf-buttons {
    display: flex;
    gap: 20px;
    width: 100%;
    flex: 0 1 auto;
    min-height: 0;
    max-height: 55%;
}

.tf-btn {
    display: flex;
    flex-direction: column;
    align-items: var(--tf-align-items, center);
    justify-content: center;
    gap: 8px;
    flex: 1;
    min-height: 160px;
    border: 3px solid #dadce0;
    border-radius: 20px;
    background: white;
    cursor: pointer;
    font-family: inherit;
    color: #444746;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 16px;
    overflow: auto;
}

.tf-icon {
    font-size: 56px;
    line-height: 1;
}

.tf-label {
    font-size: var(--ia-option-fs, 22px);
    font-weight: 700;
    line-height: var(--tf-line-height, 1.4);
    text-align: var(--tf-text-align, center);
    white-space: pre-wrap;
    word-break: break-word;
    width: 100%;
}

.tf-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.tf-btn-true:hover {
    border-color: #93c5fd;
    background: #f0f4ff;
}

.tf-btn-false:hover {
    border-color: #93c5fd;
    background: #f0f4ff;
}

.tf-btn.selected {
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.tf-btn.tf-waiting {
    border-color: #93c5fd;
    background: #eff6ff;
    color: #2563eb;
}

.tf-btn.tf-waiting .tf-icon {
    animation: tf-pulse 1.5s ease-in-out infinite;
}

@keyframes tf-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.tf-btn.correct {
    background: #e6f4ea;
    border-color: #1e8e3e;
    color: #166534;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15);
}

.tf-btn.wrong {
    background: #fce8e6;
    border-color: #d93025;
    color: #991b1b;
    box-shadow: 0 0 0 4px rgba(217, 48, 37, 0.15);
}

.tf-result {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 18px;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    border-radius: 20px;
    z-index: 10;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    animation: tfResultPop 0.3s ease;
}

.tf-result:empty {
    display: none;
}

@keyframes tfResultPop {
    from {
        transform: translateX(-50%) scale(0.8);
        opacity: 0;
    }

    to {
        transform: translateX(-50%) scale(1);
        opacity: 1;
    }
}

.tf-result.tf-pending {
    color: #1a73e8;
    background: #e8f0fe;
    border: 1px solid #a8c7fa;
}

.tf-result.success {
    color: #fff;
    background: #1e8e3e;
}

.tf-result.error {
    color: #fff;
    background: #c5221f;
}

.tf-result.tf-revealed {
    color: #444746;
    background: #f1f3f4;
}

/* 公布答案按鈕 */
.tf-reveal-area {
    margin-top: 8px;
    min-height: 40px;
}

.tf-reveal-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 28px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #1a73e8, #4285f4);
    color: white;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 16px rgba(26, 115, 232, 0.3);
}

.tf-reveal-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(26, 115, 232, 0.4);
}

.tf-reveal-btn .material-symbols-outlined {
    font-size: 20px;
}

/* 統計數據區 */
.tf-stats-area {
    margin-top: 10px;
    width: 100%;
    max-width: 400px;
}

.tf-stats-grid {
    display: flex;
    gap: 16px;
    width: 100%;
}

.tf-stat-item {
    flex: 1;
    text-align: center;
}

.tf-stat-value {
    font-size: 28px;
    font-weight: 800;
    line-height: 1.2;
}

.tf-stat-correct .tf-stat-value {
    color: #1e8e3e;
}

.tf-stat-wrong .tf-stat-value {
    color: #d93025;
}

.tf-stat-label {
    font-size: 12px;
    color: #444746;
    font-weight: 500;
    margin-bottom: 6px;
}

.tf-stat-bar {
    height: 6px;
    border-radius: 3px;
    background: #dadce0;
    overflow: hidden;
}

.tf-stat-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.tf-stat-fill.correct {
    background: linear-gradient(90deg, #1e8e3e, #4ade80);
}

.tf-stat-fill.wrong {
    background: linear-gradient(90deg, #d93025, #f87171);
}

.tf-stat-total {
    text-align: center;
    margin-top: 8px;
    font-size: 12px;
    color: #80868b;
}

/* Legacy compat */
.tf-stats {
    margin-top: 16px;
    width: 100%;
    max-width: 320px;
}

.tf-stats-bar {
    height: 6px;
    border-radius: 3px;
    background: #dadce0;
    overflow: hidden;
}

.tf-stats-fill {
    height: 100%;
    background: linear-gradient(90deg, #1e8e3e, #4ade80);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.tf-stats-label {
    margin-top: 6px;
    font-size: 12px;
    color: #444746;
    text-align: center;
}

/* ========================================
   多選一投票 - MultiChoice
   ======================================== */
.multichoice-container {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #dadce0;
    overflow: hidden;
}

.mc-question {
    font-size: 20px;
    font-weight: 700;
    color: #1f1f1f;
    text-align: center;
    margin-bottom: 16px;
    line-height: 1.4;
}

.mc-choices {
    display: flex;
    gap: 16px;
    width: 100%;
    flex: 0 1 auto;
    min-height: 0;
    max-height: 55%;
}

.mc-choice-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 120px;
    border: 3px solid #dadce0;
    border-radius: 20px;
    background: white;
    cursor: pointer;
    font-family: inherit;
    font-size: var(--ia-option-fs, 20px);
    font-weight: 700;
    color: #444746;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 16px 12px;
    overflow: auto;
    word-break: break-word;
    text-align: center;
    line-height: 1.4;
}

.mc-choice-btn[data-index="0"] { border-color: rgba(59, 130, 246, 0.3); }
.mc-choice-btn[data-index="1"] { border-color: rgba(239, 68, 68, 0.3); }
.mc-choice-btn[data-index="2"] { border-color: rgba(34, 197, 94, 0.3); }
.mc-choice-btn[data-index="3"] { border-color: rgba(245, 158, 11, 0.3); }

.mc-choice-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.mc-choice-btn[data-index="0"]:hover { border-color: #3b82f6; background: #eff6ff; color: #1d4ed8; }
.mc-choice-btn[data-index="1"]:hover { border-color: #ef4444; background: #fef2f2; color: #b91c1c; }
.mc-choice-btn[data-index="2"]:hover { border-color: #22c55e; background: #f0fdf4; color: #15803d; }
.mc-choice-btn[data-index="3"]:hover { border-color: #f59e0b; background: #fffbeb; color: #b45309; }

.mc-choice-btn.selected {
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.mc-choice-btn[data-index="0"].selected { border-color: #3b82f6; background: #dbeafe; color: #1d4ed8; }
.mc-choice-btn[data-index="1"].selected { border-color: #ef4444; background: #fee2e2; color: #b91c1c; }
.mc-choice-btn[data-index="2"].selected { border-color: #22c55e; background: #dcfce7; color: #15803d; }
.mc-choice-btn[data-index="3"].selected { border-color: #f59e0b; background: #fef3c7; color: #b45309; }

.mc-choice-btn:disabled {
    cursor: default;
    opacity: 0.7;
}

.mc-choice-btn:disabled:not(.selected) {
    opacity: 0.5;
}

.mc-result {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 18px;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    border-radius: 20px;
    z-index: 10;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    animation: tfResultPop 0.3s ease;
}

.mc-result:empty { display: none; }

.mc-result.mc-pending {
    color: #1a73e8;
    background: #e8f0fe;
    border: 1px solid #a8c7fa;
}

.mc-reveal-area {
    margin-top: 8px;
    min-height: 40px;
}

.mc-reveal-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 28px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #1a73e8, #4285f4);
    color: white;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 16px rgba(26, 115, 232, 0.3);
}

.mc-reveal-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(26, 115, 232, 0.4);
}

.mc-reveal-btn .material-symbols-outlined { font-size: 20px; }

.mc-stats-area {
    margin-top: 10px;
    width: 100%;
    max-width: 500px;
}

.mc-stats-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.mc-stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mc-stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mc-stat-label {
    font-size: 14px;
    font-weight: 600;
}

.mc-stat-value {
    font-size: 18px;
    font-weight: 800;
    color: #1f1f1f;
}

.mc-stat-bar {
    height: 8px;
    border-radius: 4px;
    background: #e5e7eb;
    overflow: hidden;
}

.mc-stat-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.mc-stat-count {
    font-size: 11px;
    color: #80868b;
    text-align: right;
}

.mc-stat-total {
    text-align: center;
    margin-top: 8px;
    font-size: 12px;
    color: #80868b;
}

/* ========================================
   開放問答 - Open Text
   ======================================== */
.opentext-container {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 24px 28px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #dadce0;
}

.opentext-question {
    font-size: 17px;
    font-weight: 600;
    color: #1f1f1f;
    margin-bottom: 14px;
}

.opentext-input {
    flex: 1;
    min-height: 80px;
    padding: 12px 14px;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    background: white;
    font-size: 14px;
    font-family: inherit;
    color: #1f1f1f;
    resize: none;
    line-height: 1.6;
}

.opentext-input:focus {
    outline: none;
    border-color: #4A7AE8;
    box-shadow: 0 0 0 2px rgba(74, 122, 232, 0.15);
}

.opentext-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.opentext-counter {
    font-size: 12px;
    color: #80868b;
}

.opentext-submit {
    padding: 6px 20px;
    background: #4A7AE8;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.opentext-submit:hover {
    background: #3b6ad4;
}

.opentext-submit:disabled {
    background: #80868b;
    cursor: default;
}

.opentext-result {
    margin-top: 8px;
    font-size: 14px;
    font-weight: 600;
}

.opentext-result.success {
    color: #1e8e3e;
}

/* ========================================
   量表評分 - Scale
   ======================================== */
.scale-container {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #dadce0;
}

.scale-question {
    font-size: 17px;
    font-weight: 600;
    color: #1f1f1f;
    margin-bottom: 20px;
    text-align: center;
}

.scale-slider-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 80%;
    max-width: 400px;
}

.scale-label-edge {
    font-size: 12px;
    color: #444746;
    white-space: nowrap;
}

.scale-slider {
    flex: 1;
    -webkit-appearance: none;
    height: 6px;
    background: #dadce0;
    border-radius: 3px;
    outline: none;
}

.scale-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    background: #4A7AE8;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(74, 122, 232, 0.3);
}

.scale-value {
    font-size: 36px;
    font-weight: 700;
    color: #4A7AE8;
    margin: 12px 0;
}

.scale-submit {
    padding: 8px 28px;
    background: #4A7AE8;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.scale-submit:hover {
    background: #3b6ad4;
}

.scale-submit:disabled {
    background: #80868b;
    cursor: default;
}

.scale-result {
    margin-top: 10px;
    font-size: 14px;
    font-weight: 600;
}

.scale-result.success {
    color: #1e8e3e;
}

/* ========================================
   搶答 - Buzzer (文字輸入)
   ======================================== */
.buzzer-container {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #dadce0;
}

.buzzer-question {
    font-size: 17px;
    font-weight: 600;
    color: #1f1f1f;
    margin-bottom: 20px;
    text-align: center;
}

.buzzer-input-row {
    display: flex;
    gap: 8px;
    width: 100%;
    max-width: 400px;
}

.buzzer-text-input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #dadce0;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    color: #1f1f1f;
    transition: border-color 0.2s;
}

.buzzer-text-input:focus {
    outline: none;
    border-color: #4A7AE8;
}

.buzzer-text-input:disabled {
    background: #f1f3f4;
    color: #444746;
}

.buzzer-submit-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(145deg, #d93025, #c5221f);
    color: white;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(217, 48, 37, 0.3);
    transition: all 0.15s;
    white-space: nowrap;
}

.buzzer-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(217, 48, 37, 0.4);
}

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

.buzzer-submit-btn.pressed,
.buzzer-submit-btn:disabled {
    background: #80868b;
    box-shadow: none;
    cursor: default;
    transform: none;
}

.buzzer-result {
    margin-top: 14px;
    font-size: 14px;
    font-weight: 600;
}

.buzzer-result.success {
    color: #1e8e3e;
}

.buzzer-ranking {
    margin-top: 12px;
    text-align: left;
    width: 100%;
    max-width: 400px;
}

.buzzer-rank-title {
    font-size: 13px;
    font-weight: 700;
    color: #444746;
    margin-bottom: 6px;
}

.buzzer-rank-item {
    padding: 5px 0;
    font-size: 13px;
    color: #1f1f1f;
    border-bottom: 1px solid #f1f3f4;
    display: flex;
    gap: 8px;
    align-items: center;
}

.buzzer-rank-name {
    font-weight: 600;
    flex: 1;
}

.buzzer-rank-answer {
    color: #444746;
    font-size: 12px;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.buzzer-medal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    background: #80868b;
}

.buzzer-medal.gold {
    background: linear-gradient(135deg, #f9ab00, #e37400);
}

.buzzer-medal.silver {
    background: linear-gradient(135deg, #80868b, #444746);
}

.buzzer-medal.bronze {
    background: linear-gradient(135deg, #e37400, #92400e);
}

.buzzer-status {
    margin-top: 12px;
    font-size: 14px;
    font-weight: 500;
    color: #444746;
}

.buzzer-status.claimed {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #c5221f;
    font-weight: 600;
    padding: 8px 14px;
    background: #fce8e6;
    border: 1px solid #fecaca;
    border-radius: 8px;
    margin-top: 12px;
}

/* ========================================
   文字雲 - Word Cloud
   ======================================== */
.wordcloud-container {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 24px 28px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #dadce0;
}

.wordcloud-body {
    display: flex;
    flex: 1;
    gap: 16px;
    min-height: 0;
    overflow: hidden;
}

.wordcloud-question {
    font-size: 17px;
    font-weight: 600;
    color: #1f1f1f;
    margin-bottom: 12px;
}

.wordcloud-input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.wordcloud-multi-input {
    width: 35%;
    min-width: 180px;
    max-width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.wc-inputs {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
    flex: 1;
    overflow-y: auto;
}

.wc-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.wc-count {
    font-size: 12px;
    color: #80868b;
}

.wordcloud-input {
    flex: 1;
    padding: 8px 12px;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: #1f1f1f;
}

.wordcloud-input:focus {
    outline: none;
    border-color: #4A7AE8;
}

.wordcloud-submit {
    padding: 8px 18px;
    background: #4A7AE8;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
}

.wordcloud-submit:disabled {
    background: #80868b;
    cursor: default;
}

.wordcloud-result {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
}

.wordcloud-result.success {
    color: #1e8e3e;
}

.wordcloud-cloud {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-content: center;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    background: white;
    border-radius: 10px;
    border: 1px solid #dadce0;
    overflow: auto;
    min-width: 0;
}

.wordcloud-word {
    padding: 4px 10px;
    transition: transform 0.2s;
    font-weight: 600;
    max-width: 45%;
    word-break: break-word;
    text-align: center;
    line-height: 1.3;
}

.wordcloud-word:hover {
    transform: scale(1.15);
}

.wordcloud-empty {
    color: #80868b;
    font-size: 13px;
}

.wc-submitted .wc-inputs {
    display: none;
}

.wc-submitted .wc-footer {
    justify-content: flex-end;
}

.wc-submitted .wordcloud-submit {
    display: none;
}

.wc-submitted {
    width: auto;
    min-width: 0;
    max-width: none;
    flex-shrink: 1;
}

.wc-cloud-expanded {
    flex: 1;
    min-height: 120px;
    display: flex;
    flex-wrap: wrap;
    align-content: center;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
}

/* ── 文字雲 overflow 修正 ── */
.wordcloud-cloud {
    overflow-y: auto;
}
.wordcloud-word {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* ── AI 分類面板（講師端右側）── */
.wc-ai-panel {
    width: 200px;
    min-width: 160px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow: hidden;
}

.wc-ai-btn {
    padding: 6px 12px;
    background: #475569;
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all .2s;
    white-space: nowrap;
    flex-shrink: 0;
}
.wc-ai-btn:hover:not(:disabled) {
    background: #334155;
}
.wc-ai-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

.wc-ai-result {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    overflow: hidden;
}

.wc-ai-cat {
    padding: 4px 6px;
}
.wc-ai-cat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 2px;
}
.wc-ai-pct {
    font-size: 13px;
    font-weight: 700;
}
.wc-ai-bar {
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
}
.wc-ai-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width .5s ease;
}

/* ========================================
   圖片標註 - Hotspot (區域標註 + 熱點圖)
   ======================================== */
.hotspot-container {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 20px 24px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #dadce0;
}

.hotspot-question {
    font-size: 16px;
    font-weight: 600;
    color: #1f1f1f;
    margin-bottom: 10px;
}

.hotspot-image-wrap {
    flex: 1;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid #dadce0;
    position: relative;
    cursor: crosshair;
    min-height: 180px;
}

.hotspot-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

.hotspot-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 180px;
    color: #80868b;
    font-size: 14px;
    background: #f1f3f4;
    gap: 4px;
}

/* ── SVG 標註覆蓋層 ── */
.hs-marker-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.hs-circle-glow {
    fill: none;
    stroke: rgba(59, 130, 246, 0.25);
    stroke-width: 1.5;
}

.hs-circle-main {
    fill: rgba(59, 130, 246, 0.1);
    stroke: rgba(59, 130, 246, 0.7);
    stroke-width: 0.5;
    stroke-dasharray: 2 1;
    transition: fill 0.25s, stroke 0.25s;
}

.hs-circle-main.submitted {
    fill: rgba(16, 185, 129, 0.12);
    stroke: rgba(16, 185, 129, 0.7);
    stroke-dasharray: none;
}

.hs-crosshair line {
    stroke: rgba(59, 130, 246, 0.45);
    stroke-width: 0.25;
}

/* ── 游標跟隨預覽圈（桌面版） ── */
.hs-preview-group {
    transition: opacity 0.2s ease;
}

.hs-preview-glow {
    fill: none;
    stroke: rgba(59, 130, 246, 0.15);
    stroke-width: 1.5;
    animation: hsPreviewPulse 1.8s ease-in-out infinite;
}

.hs-preview-circle {
    fill: rgba(59, 130, 246, 0.06);
    stroke: rgba(59, 130, 246, 0.4);
    stroke-width: 0.4;
    stroke-dasharray: 2.5 1.5;
}

.hs-preview-cross {
    stroke: rgba(59, 130, 246, 0.3);
    stroke-width: 0.2;
}

@keyframes hsPreviewPulse {
    0%, 100% { stroke-width: 1.5; stroke: rgba(59, 130, 246, 0.15); }
    50% { stroke-width: 2.5; stroke: rgba(59, 130, 246, 0.25); }
}

/* ── 放置後的呼吸動畫 ── */
.hs-circle-glow {
    animation: hsGlowBreathe 2s ease-in-out infinite;
}

@keyframes hsGlowBreathe {
    0%, 100% { stroke-width: 1.5; stroke: rgba(59, 130, 246, 0.25); }
    50% { stroke-width: 2.5; stroke: rgba(59, 130, 246, 0.4); }
}

/* ── 手機引導提示 ── */
.hs-tap-hint {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    pointer-events: none;
    z-index: 8;
    transition: opacity 0.3s;
    background: rgba(0, 0, 0, 0.04);
}

.hs-tap-hint-icon {
    font-size: 28px;
    color: #1a73e8;
    animation: hsTapHintBounce 2s ease-in-out infinite;
}

.hs-tap-hint span:last-child {
    font-size: 14px;
    font-weight: 600;
    color: #5f6368;
    background: rgba(255, 255, 255, 0.85);
    padding: 6px 14px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(4px);
}

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

/* ── 半徑調整滑桿 ── */
.hs-radius-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #f1f3f4;
    border-radius: 8px;
    margin-top: 8px;
}

.hs-radius-slider {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: #dadce0;
    border-radius: 2px;
    outline: none;
}

.hs-radius-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #1a73e8;
    border: 2px solid white;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    cursor: pointer;
}

/* ── Canvas 熱點圖 ── */
.hs-heatmap-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none;
    opacity: 0.72;
    border-radius: inherit;
}

/* ── 人數統計 ── */
.hs-count {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    color: #5f6368;
    background: #f1f3f4;
    border-radius: 8px;
    margin-top: 8px;
}

/* ── 熱點圖圖例 ── */
.hs-heatmap-legend {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    margin-top: 8px;
    padding: 0 4px;
}

.hs-legend-bar {
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, #3c3cff, #00d4ff, #00ff6e, #d4ff00, #ff6e00, #ff0000);
    opacity: 0.8;
}

.hs-legend-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #80868b;
}

/* ── 送出按鈕 & 結果 ── */
.hotspot-actions {
    margin-top: 10px;
}

.hs-submit-btn {
    width: 100%;
    padding: 10px 16px;
    background: #1a73e8;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
}

.hs-submit-btn:hover:not(:disabled) {
    background: #1557b0;
}

.hs-submit-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.hotspot-result {
    margin-top: 8px;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.hotspot-result.success {
    color: #1e8e3e;
}

.hotspot-result.error {
    color: #d93025;
}

/* ========================================
   簡報排行榜 — 右側欄
   ======================================== */

/* 排行榜打開時，投影片容器改為雙欄佈局 */


/* ═══════════════════════════════════
   排行榜 — 白底專業風
   ═══════════════════════════════════ */
.pres-leaderboard {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 280px;
    background: #ffffff;
    border-left: 1px solid #e5e7eb;
    z-index: 180;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
    overflow: hidden;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.08);
}

.pres-leaderboard.open {
    transform: translateX(0);
}

/* ── 標題區 ── */
.lb-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 18px;
    font-size: 14px;
    font-weight: 700;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
    background: #fafafa;
    color: #1f2937;
    letter-spacing: 0.3px;
}

.lb-header .material-symbols-outlined {
    font-size: 20px;
    color: #1a73e8;
}

/* ── 列表區 ── */
.lb-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 8px;
    scrollbar-width: thin;
    scrollbar-color: #e5e7eb transparent;
}

.lb-list::-webkit-scrollbar { width: 3px; }
.lb-list::-webkit-scrollbar-track { background: transparent; }
.lb-list::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 2px; }

.lb-empty {
    padding: 40px 18px;
    text-align: center;
    color: #80868b;
    font-size: 13px;
}

/* ── 每一列 ── */
.lb-row {
    padding: 8px 12px;
    border-radius: 10px;
    margin-bottom: 3px;
    transition: all 0.3s ease;
    position: relative;
    overflow: visible;
    background: transparent;
    border: 1px solid transparent;
}

.lb-row:hover {
    background: #f9fafb;
    border-color: #e5e7eb;
}

/* 🥇 第一名 */
.lb-row:nth-child(1) {
    background: linear-gradient(135deg, #fffbeb, #fef7e0);
    border-color: #fde68a;
}

/* 🥈 第二名 */
.lb-row:nth-child(2) {
    background: linear-gradient(135deg, #f8f9fa, #f1f3f4);
    border-color: #dadce0;
}

/* 🥉 第三名 */
.lb-row:nth-child(3) {
    background: linear-gradient(135deg, #fff7ed, #ffedd5);
    border-color: #fed7aa;
}

.lb-row-top {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

/* ── 名次徽章 ── */
.lb-rank {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    flex-shrink: 0;
    color: #80868b;
    background: #f3f4f6;
    border: 1.5px solid #e5e7eb;
    transition: all 0.3s;
}

.lb-rank.gold {
    background: linear-gradient(135deg, #fbbf24, #f9ab00);
    color: #fff;
    border-color: #f9ab00;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.lb-rank.silver {
    background: linear-gradient(135deg, #dadce0, #80868b);
    color: #fff;
    border-color: #cbd5e1;
    box-shadow: 0 2px 6px rgba(148, 163, 184, 0.25);
}

.lb-rank.bronze {
    background: linear-gradient(135deg, #fb923c, #ea580c);
    color: #fff;
    border-color: #f97316;
    box-shadow: 0 2px 6px rgba(249, 115, 22, 0.25);
}

/* ── 名字 ── */
.lb-name {
    flex: 1;
    min-width: 0; /* ★ 允許 flexbox 子元素縮小，text-overflow 才能生效 */
    font-size: 13px;
    color: #5f6368;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.lb-row:nth-child(-n+3) .lb-name {
    color: #1f2937;
    font-weight: 700;
}

/* ── 分數 ── */
.lb-pts {
    font-size: 14px;
    font-weight: 800;
    color: #374151;
    flex-shrink: 0;
    min-width: 32px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    position: relative;
}

.lb-row:nth-child(1) .lb-pts {
    color: #e37400;
}

.lb-row:nth-child(n+4) .lb-pts {
    color: #80868b;
    font-weight: 700;
    font-size: 13px;
}

/* ── 進度條 ── */
.lb-bar-wrap {
    height: 4px;
    background: #f3f4f6;
    border-radius: 2px;
    overflow: hidden;
}

.lb-bar {
    height: 100%;
    border-radius: 2px;
    transition: width 0.8s cubic-bezier(0.32, 0.72, 0, 1);
    min-width: 0;
}

.lb-row:nth-child(1) .lb-bar {
    background: linear-gradient(90deg, #fbbf24, #f9ab00);
}

.lb-row:nth-child(2) .lb-bar {
    background: linear-gradient(90deg, #80868b, #444746);
}

.lb-row:nth-child(3) .lb-bar {
    background: linear-gradient(90deg, #fb923c, #ea580c);
}

.lb-row:nth-child(n+4) .lb-bar {
    background: linear-gradient(90deg, #1a73e8, #4285f4);
    opacity: 0.5;
}

/* ── 組別排行卡片 ── */
.lb-group-row {
    border-left: 3px solid var(--gp-color, #6366f1) !important;
    border-radius: 3px 8px 8px 3px !important;
    padding: 6px 8px 6px 10px !important;
    margin-bottom: 4px !important;
    cursor: pointer;
}
.lb-group-row .lb-row-top {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}
.lb-group-row .lb-bar-wrap { margin-top: 2px; }
.lb-group-info {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: 4px;
}
.lb-group-info-name {
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    color: #1f2937;
}
.lb-group-info-count {
    font-size: 9px;
    color: #9ca3af;
    white-space: nowrap;
}
.lb-group-score {
    font-size: 15px;
    font-weight: 800;
    flex-shrink: 0;
    text-align: right;
    line-height: 1;
    min-width: 24px;
}
.lb-group-row:nth-child(1) .lb-group-score { color: #e37400; }
.lb-group-row:nth-child(2) .lb-group-score { color: #64748b; }
.lb-group-row:nth-child(3) .lb-group-score { color: #ea580c; }
.lb-group-row:nth-child(n+4) .lb-group-score { color: #94a3b8; font-size: 13px; }
.lb-group-avg-label {
    font-size: 9px;
    color: #b0b8c1;
    text-align: right;
}
.lb-group-members {
    padding: 3px 0 2px 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 3px 8px;
    max-height: 80px;
    overflow-y: auto;
}
.lb-group-members::-webkit-scrollbar { width: 2px; }
.lb-group-members::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 2px; }
.lb-gm {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    color: #64748b;
    white-space: nowrap;
}
.lb-gm-dot {
    width: 5px; height: 5px;
    border-radius: 50%;
    flex-shrink: 0;
}
.lb-gm-pts {
    color: #b0b8c1;
    font-size: 9px;
    font-weight: 600;
}

/* ── 加分動畫 ── */
.lb-score-popup {
    position: absolute;
    right: 12px;
    top: -2px;
    color: #1e8e3e;
    font-size: 14px;
    font-weight: 800;
    pointer-events: none;
    animation: lbScorePopup 1.2s ease-out forwards;
    z-index: 10;
}

@keyframes lbScorePopup {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    30% { opacity: 1; transform: translateY(-12px) scale(1.3); }
    100% { opacity: 0; transform: translateY(-30px) scale(0.8); }
}

.lb-row.rank-up {
    animation: lbRankUp 0.6s ease;
}

@keyframes lbRankUp {
    0%, 100% { background: inherit; }
    50% { background: rgba(34, 197, 94, 0.08); border-color: rgba(34, 197, 94, 0.2); }
}

.lb-score-popup.lb-score-negative {
    color: #c5221f;
    animation: lbScorePopupDown 1.2s ease-out forwards;
}

@keyframes lbScorePopupDown {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    30% { opacity: 1; transform: translateY(8px) scale(1.2); }
    100% { opacity: 0; transform: translateY(24px) scale(0.8); }
}

/* ── Toggle 按鈕 ── */
.lb-toggle {
    position: fixed;
    right: 12px;
    top: 56px;
    z-index: 190;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #5f6368;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.lb-toggle:hover {
    background: #fff;
    color: #1a73e8;
    border-color: rgba(26, 115, 232, 0.3);
    box-shadow: 0 2px 8px rgba(26, 115, 232, 0.1);
}

.lb-toggle .material-symbols-outlined {
    font-size: 18px;
}

.presentation-mode.active .lb-toggle {
    display: flex;
}

.pres-leaderboard.open~.lb-toggle {
    right: 292px;
}

/* ═══════════════════════════════════
   演講者備忘稿面板 — 左側欄
   ═══════════════════════════════════ */
.pres-notes-panel {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 320px;
    background: #ffffff;
    border-right: 1px solid #e5e7eb;
    z-index: 180;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
    overflow: hidden;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.08);
}

.pres-notes-panel.open {
    transform: translateX(0);
}

/* ── 標題區 ── */
.pres-notes-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    font-size: 14px;
    font-weight: 700;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
    background: #fafafa;
    color: #1f2937;
    letter-spacing: 0.3px;
}

.pres-notes-header .material-symbols-outlined {
    font-size: 20px;
    color: #1a73e8;
}

/* ── 計時器 ── */
.pres-timer {
    margin-left: auto;
    font-size: 16px;
    font-weight: 800;
    color: #1a73e8;
    font-variant-numeric: tabular-nums;
    font-family: 'Courier New', monospace;
    background: rgba(26, 115, 232, 0.08);
    padding: 3px 10px;
    border-radius: 6px;
}

/* ── 內容區 ── */
.pres-notes-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

.pres-notes-content {
    flex: 1;
    padding: 16px 18px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.8;
    color: #374151;
    white-space: pre-wrap;
    word-break: break-word;
    scrollbar-width: thin;
    scrollbar-color: #e5e7eb transparent;
}

.pres-notes-content::-webkit-scrollbar { width: 3px; }
.pres-notes-content::-webkit-scrollbar-track { background: transparent; }
.pres-notes-content::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 2px; }

.pres-notes-empty {
    color: #94a3b8;
    font-size: 13px;
    font-style: italic;
    text-align: center;
    padding: 24px 0;
}

/* ── 分隔線 ── */
.pres-notes-divider {
    height: 1px;
    background: #f0f0f0;
    margin: 0 18px;
    flex-shrink: 0;
}

/* ── 下一張預覽 ── */
.pres-notes-next-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px 6px;
    font-size: 12px;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.pres-notes-next-label .material-symbols-outlined {
    color: #9ca3af;
}

.pres-notes-next {
    flex-shrink: 0;
    margin: 0 18px 12px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    aspect-ratio: 16 / 9;
    position: relative;
}

.pres-notes-next canvas,
.pres-notes-next .next-slide-preview {
    width: 100%;
    height: 100%;
    display: block;
}

/* ── 頁碼 ── */
.pres-notes-counter {
    padding: 8px 18px 14px;
    font-size: 12px;
    font-weight: 600;
    color: #9ca3af;
    text-align: center;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* ── toggle 按鈕 ── */
.pres-notes-toggle {
    position: fixed;
    left: 12px;
    top: 56px;
    z-index: 190;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #5f6368;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.pres-notes-toggle:hover {
    background: #fff;
    color: #1a73e8;
    border-color: rgba(26, 115, 232, 0.3);
    box-shadow: 0 2px 8px rgba(26, 115, 232, 0.1);
}

.pres-notes-toggle .material-symbols-outlined {
    font-size: 18px;
}

.presentation-mode.active .pres-notes-toggle {
    display: flex;
}

.pres-notes-panel.open ~ .pres-notes-toggle {
    left: 332px;
}

/* 備忘稿面板打開時，投影片往右偏移 */
.presentation-mode.notes-active {
    padding-left: 320px;
}/* ========================================
   文件檢視器 — 錨點（找錯練習）
   ======================================== */
.doc-anchors-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #dadce0;
}

.doc-anchors-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 700;
    color: #1f1f1f;
    margin-bottom: 14px;
}

.doc-anchors-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.doc-anchor-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: #f8f9fa;
    border: 1.5px solid #dadce0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.doc-anchor-card:hover {
    background: #f1f3f4;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.doc-anchor-card.checked {
    background: #fff7ed;
    border-color: #fdba74;
    box-shadow: 0 0 0 2px rgba(251, 146, 60, 0.15);
}

.doc-anchor-card.checked .doc-anchor-check {
    color: #f9ab00;
}

/* 公布後樣式 */
.doc-anchor-card.revealed {
    cursor: default;
    pointer-events: none;
}

.doc-anchor-card.revealed.is-error {
    background: #fce8e6;
    border-color: #fca5a5;
    box-shadow: 0 0 0 2px rgba(217, 48, 37, 0.12);
}

.doc-anchor-card.revealed.is-error::after {
    content: '✕ 此處有錯';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    font-weight: 700;
    color: #c5221f;
    background: #fce8e6;
    padding: 2px 8px;
    border-radius: 4px;
}

.doc-anchor-card.revealed.is-correct {
    background: #e6f4ea;
    border-color: #86efac;
}

.doc-anchor-card.revealed.is-correct::after {
    content: '✓ 正確';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    font-weight: 700;
    color: #1e8e3e;
    background: #e6f4ea;
    padding: 2px 8px;
    border-radius: 4px;
}

.doc-anchor-card.revealed {
    position: relative;
}

.doc-anchor-check {
    color: #80868b;
    flex-shrink: 0;
    margin-top: 1px;
}

.doc-anchor-check .material-symbols-outlined {
    font-size: 22px;
}

.doc-anchor-label {
    font-size: 14px;
    color: #1f1f1f;
    line-height: 1.5;
    flex: 1;
}

/* 提交 / 公布按鈕 */
.doc-submit-anchors,
.doc-reveal-btn {
    margin-top: 16px;
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.doc-submit-anchors {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.doc-submit-anchors:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.doc-submit-anchors.submitted {
    background: #1e8e3e;
    cursor: default;
    box-shadow: none;
}

.doc-reveal-btn {
    background: linear-gradient(135deg, #4285f4, #1a73e8);
    color: white;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

.doc-reveal-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
}

/* 統計面板 */
.doc-stats-panel {
    margin-top: 20px;
    padding: 16px;
    background: #fafafa;
    border-radius: 12px;
    border: 1px solid #dadce0;
}

.doc-stats-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: #1f1f1f;
    margin-bottom: 14px;
}

.doc-stat-row {
    margin-bottom: 10px;
}

.doc-stat-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #444746;
    margin-bottom: 4px;
}

.doc-stat-num {
    width: 20px;
    height: 20px;
    border-radius: 5px;
    background: #dadce0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #444746;
    flex-shrink: 0;
}

.doc-stat-tag {
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}

.doc-stat-tag.error {
    background: #fce8e6;
    color: #c5221f;
}

.doc-stat-tag.correct {
    background: #e6f4ea;
    color: #1e8e3e;
}

.doc-stat-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.doc-stat-bar-wrap {
    height: 8px;
    background: #dadce0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 2px;
}

.doc-stat-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.32, 0.72, 0, 1);
    min-width: 2px;
}

.doc-stat-pct {
    font-size: 12px;
    color: #444746;
    font-weight: 600;
}

/* 首次計分制 — 重複作答提示橫幅 */
.retry-score-banner {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 8px 14px;
    background: linear-gradient(135deg, #dbeafe, #eff6ff);
    border: 1px solid #93c5fd;
    border-radius: 8px;
    color: #1e40af;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
    animation: retryBannerIn 0.3s ease;
}

@keyframes retryBannerIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ═══ 文件檢視器 — 段落點擊式 ═══ */
.doc-para-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #fef7e0, #fffbeb);
    border: 1px solid #fcd34d;
    border-radius: 10px;
    color: #92400e;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
}

.doc-para-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.doc-para-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    border: 1.5px solid #dadce0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
    position: relative;
}

.doc-para-item:hover {
    border-color: #f9ab00;
    background: #fffbeb;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.1);
}

.doc-para-item.marked {
    border-color: #f9ab00;
    background: linear-gradient(135deg, #fffbeb, #fef7e0);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
}

.doc-para-item.revealed.is-error {
    border-color: #d93025;
    background: #fce8e6;
}

.doc-para-item.revealed.is-correct {
    border-color: #1e8e3e;
    background: #e6f4ea;
}

.doc-para-badge {
    min-width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #dadce0;
    color: #444746;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 2px;
}

.doc-para-item.marked .doc-para-badge {
    background: #f9ab00;
    color: white;
}

.doc-para-item.revealed.is-error .doc-para-badge {
    background: #d93025;
    color: white;
}

.doc-para-item.revealed.is-correct .doc-para-badge {
    background: #1e8e3e;
    color: white;
}

.doc-para-text {
    flex: 1;
    font-size: 13px;
    line-height: 1.7;
    color: #1f1f1f;
}

.doc-para-mark {
    flex-shrink: 0;
    color: #cbd5e1;
    transition: color 0.2s;
}

.doc-para-item.marked .doc-para-mark {
    color: #f9ab00;
}

.doc-para-item:hover .doc-para-mark {
    color: #80868b;
}

.doc-para-actions {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ═══ 下載格式選單 ═══ */
.doc-download-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: white;
    border: 1px solid #dadce0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    min-width: 180px;
    z-index: 100;
    overflow: hidden;
}

.doc-download-menu.open {
    display: block;
}

.doc-dl-opt {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    color: #1f1f1f;
    transition: background 0.15s;
    text-align: left;
}

.doc-dl-opt:hover {
    background: #f1f3f4;
}

.doc-dl-opt .material-symbols-outlined {
    font-size: 18px;
    color: #444746;
}

.doc-dl-opt:first-child {
    border-bottom: 1px solid #f1f3f4;
    font-weight: 600;
    color: #0284c7;
}

.doc-dl-opt:first-child .material-symbols-outlined {
    color: #0284c7;
}

/* ========================================
   排行榜元件 - Leaderboard Widget
   ======================================== */
.leaderboard-element {
    border-radius: 16px;
    background: linear-gradient(145deg, #0f172a, #1f1f1f);
    color: #fff;
}

.lb-widget {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 16px;
    box-sizing: border-box;
}

.lb-widget-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 12px;
    justify-content: center;
    letter-spacing: 1px;
}

.lb-trophy {
    font-size: 28px;
    animation: lb-trophy-bounce 2s ease-in-out infinite;
}

@keyframes lb-trophy-bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-4px);
    }
}

.lb-podium {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 6px;
    flex: 1;
    min-height: 0;
    padding-top: 8px;
}

.lb-podium-slot {
    flex: 1;
    max-width: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.lb-empty-slot {
    visibility: hidden;
}

.lb-podium-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 3px solid;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.lb-medal {
    font-size: 22px;
}

.lb-podium-name {
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    color: rgba(255, 255, 255, 0.9);
}

.lb-podium-pts {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 500;
}

.lb-podium-bar {
    width: 100%;
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 8px;
    position: relative;
}

.lb-podium-rank {
    font-size: 28px;
    font-weight: 800;
    opacity: 0.3;
}

.lb-rest {
    margin-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 6px;
    max-height: 120px;
    overflow-y: auto;
}

.lb-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-radius: 6px;
    font-size: 13px;
}

.lb-row:nth-child(odd) {
    background: rgba(255, 255, 255, 0.03);
}

.lb-row-rank {
    width: 20px;
    text-align: center;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.lb-row-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.8);
}

.lb-row-pts {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    flex-shrink: 0;
    font-size: 12px;
}

.lb-no-data {
    text-align: center;
    color: rgba(255, 255, 255, 0.3);
    font-size: 14px;
    padding: 24px;
}

/* ========================================
   連結卡片元素（student side duplicate）
   ======================================== */
.link-card {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    height: 100%;
    padding: 12px 18px;
    border-radius: 14px;
    background: linear-gradient(135deg, #f0f4ff 0%, #faf5ff 100%);
    border: 1.5px solid rgba(26, 115, 232, 0.2);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(26, 115, 232, 0.06);
    box-sizing: border-box;
}

.link-card:hover {
    border-color: rgba(26, 115, 232, 0.4);
    box-shadow: 0 4px 16px rgba(26, 115, 232, 0.12);
    transform: translateY(-1px);
}

.link-card-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, #1a73e8, #4285f4);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: white;
}

.link-card-icon .material-symbols-outlined {
    font-size: 22px;
}

.link-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.link-card-label {
    font-size: 15px;
    font-weight: 700;
    color: #1f1f1f;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.link-card-desc {
    font-size: 12px;
    color: #444746;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.link-card-url {
    font-size: 11px;
    color: #1a73e8;
    font-family: 'Courier New', monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0.7;
}

.link-card-arrow {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(26, 115, 232, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #1a73e8;
    transition: all 0.25s;
}

.link-card:hover .link-card-arrow {
    background: #1a73e8;
    color: white;
    transform: translateX(2px);
}

.link-card-arrow .material-symbols-outlined {
    font-size: 18px;
}

/* ========================================
   加分動畫 — Score Popup (Premium)
   ======================================== */
.score-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    z-index: 10000;
    pointer-events: none;
    animation: scorePopupEntry 2.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.score-popup-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #fbbf24 0%, #f9ab00 50%, #e37400 100%);
    color: #78350f;
    border-radius: 28px;
    font-size: 22px;
    font-weight: 800;
    box-shadow:
        0 0 0 4px rgba(251, 191, 36, 0.25),
        0 8px 32px rgba(245, 158, 11, 0.5),
        0 2px 8px rgba(0, 0, 0, 0.15);
    font-family: 'Noto Sans TC', sans-serif;
    white-space: nowrap;
    position: relative;
    overflow: visible;
    letter-spacing: 0.02em;
}

.score-popup-inner .material-symbols-outlined {
    font-size: 26px;
    color: #92400e;
    animation: starSpin 0.6s ease-out 0.15s;
}

/* 光暈擴散環 */
.score-popup-inner::before {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 36px;
    background: radial-gradient(ellipse, rgba(251, 191, 36, 0.4), transparent 70%);
    animation: scoreGlow 1.5s ease-out forwards;
    pointer-events: none;
}

/* 粒子軌跡 */
.score-popup-inner::after {
    content: '✦ ✧ ★ ✦ ✧';
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    letter-spacing: 8px;
    color: #fbbf24;
    animation: scoreParticles 1.8s ease-out 0.2s forwards;
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
}

@keyframes scorePopupEntry {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0) rotate(-10deg);
    }
    12% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.25) rotate(2deg);
    }
    22% {
        transform: translate(-50%, -50%) scale(0.95) rotate(-1deg);
    }
    32% {
        transform: translate(-50%, -50%) scale(1.05) rotate(0deg);
    }
    42% {
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
    }
    72% {
        opacity: 1;
        transform: translate(-50%, -55%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -120%) scale(0.7);
    }
}

@keyframes starSpin {
    0% { transform: rotate(0deg) scale(0.5); }
    50% { transform: rotate(180deg) scale(1.3); }
    100% { transform: rotate(360deg) scale(1); }
}

@keyframes scoreGlow {
    0% { opacity: 0; transform: scale(0.8); }
    30% { opacity: 1; transform: scale(1.2); }
    100% { opacity: 0; transform: scale(2); }
}

@keyframes scoreParticles {
    0% { opacity: 0; transform: translateX(-50%) translateY(0); }
    20% { opacity: 1; }
    100% { opacity: 0; transform: translateX(-50%) translateY(-40px); letter-spacing: 20px; }
}

/* ── 手機端 showcase 作業牆修復 ── */
@media (max-width: 1024px) {
    /* 移除嵌套 transform，避免 iOS Safari 在 transform:scale 父元素內渲染異常 */
    .showcase-container {
        will-change: auto;
        -webkit-transform: none;
        transform: none;
        overflow: visible;
        height: auto !important;
        min-height: 200px;
        max-height: none !important;
    }

    /* 作業牆 grid 改為垂直滾動、wrap */
    .showcase-grid {
        flex-wrap: wrap;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-transform: none;
        transform: none;
        max-height: 60vh;
    }

    /* 卡片寬度自適應 */
    .showcase-work-card {
        flex: 0 0 auto;
        width: calc(50% - 7px);
        max-width: none;
        min-width: 120px;
    }

    .showcase-header-bar {
        font-size: 12px;
        padding: 6px 10px;
    }

    .showcase-status-row {
        padding: 4px 8px;
        gap: 4px;
    }

    /* 作業牆圖片在手機端自適應 */
    .showcase-work-body img {
        max-width: 100%;
        height: auto;
    }
}

/* 更窄的螢幕（手機直立） */
@media (max-width: 480px) {
    .showcase-work-card {
        width: 100%;
        flex-basis: 100%;
    }
}