/* Venn Diagram & Sets Template Styles — Responsive, Touch-Friendly, Legacy-Safe */
.vd-wrap {
    width: 100%;
    max-width: 820px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    user-select: none;
    -webkit-user-select: none;
}

.vd-header-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 6px;
}

.vd-prompt-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 180px;
}

.vd-question-text {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--ink, #1e293b);
    line-height: 1.35;
    margin: 0;
}

.vd-remaining-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(79, 70, 229, 0.1);
    color: #4338ca;
    border: 1px solid rgba(79, 70, 229, 0.25);
    border-radius: 9999px;
    padding: 4px 12px;
    font-size: 0.82rem;
    font-weight: 800;
    white-space: nowrap;
}

.vd-remaining-pill.is-done {
    background: rgba(16, 185, 129, 0.14);
    color: #047857;
    border-color: rgba(16, 185, 129, 0.35);
}

.vd-hint-bar {
    text-align: center;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--muted, #64748b);
    margin: 0;
}

/* Stage & Overlapping Venn Circles (Universal Set Frame) */
.vd-stage {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 14px 10px 12px;
    border: 2px solid #cbd5e1;
    border-radius: 16px;
    background: #f8fafc;
    box-sizing: border-box;
    transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.vd-stage.vd-universal-frame {
    border: 2.5px solid #475569;
    padding-bottom: 14px;
}

.vd-stage.vd-universal-frame.is-awaiting-tap {
    cursor: pointer;
}

.vd-stage.vd-universal-frame.is-drop-target {
    border-color: #4f46e5;
    background: #eef2ff;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.16);
}

.vd-circles-row {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 720px;
    direction: ltr;
}

.vd-circle {
    position: relative;
    width: 318px;
    height: 318px;
    border-radius: 50%;
    border: 3px solid var(--vd-color, #3b82f6);
    background: var(--vd-bg, rgba(59, 130, 246, 0.1));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 16px 26px 18px;
    box-sizing: border-box;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
    cursor: pointer;
    flex-shrink: 0;
    overflow: hidden;
}

.vd-circle-a {
    margin-right: -46px;
    padding-right: 54px;
    z-index: 2;
}

.vd-circle-b {
    margin-left: -46px;
    padding-left: 54px;
    z-index: 2;
}

.vd-circle.is-drop-target {
    transform: scale(1.02);
    box-shadow: 0 0 0 5px var(--vd-glow, rgba(59, 130, 246, 0.25)), 0 12px 26px rgba(15, 23, 42, 0.12);
    background: var(--vd-bg-active, rgba(59, 130, 246, 0.2));
}

.vd-set-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 90%;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 0.84rem;
    font-weight: 800;
    color: #ffffff;
    background: var(--vd-color, #3b82f6);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
    text-align: center;
    line-height: 1.25;
    margin-bottom: 8px;
    pointer-events: none;
    word-break: break-word;
}

/* Central Intersection Lens (A ∩ B) */
.vd-lens-overlay {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 126px;
    min-height: 224px;
    max-height: 268px;
    border-radius: 56px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 12px 6px;
    box-sizing: border-box;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.16) 0%, rgba(16, 185, 129, 0.16) 100%);
    border: 2px dashed rgba(109, 40, 217, 0.45);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.vd-lens-overlay.is-drop-target {
    transform: translate(-50%, -50%) scale(1.05);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.3) 0%, rgba(16, 185, 129, 0.3) 100%);
    border-style: solid;
    border-color: #7c3aed;
    box-shadow: 0 0 0 5px rgba(124, 58, 237, 0.22), 0 10px 24px rgba(124, 58, 237, 0.2);
}

.vd-lens-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 800;
    color: #ffffff;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    box-shadow: 0 2px 5px rgba(99, 102, 241, 0.3);
    text-align: center;
    line-height: 1.2;
    margin-bottom: 6px;
    pointer-events: none;
    white-space: nowrap;
}

/* Zone Trays & Placed Chips */
.vd-zone-tray {
    width: 100%;
    flex: 1 1 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    align-content: flex-start;
    justify-content: center;
    gap: 5px;
    overflow-y: auto;
    padding: 4px 2px;
}

.vd-wrap.vd-dragging-active .vd-circle,
.vd-wrap.vd-dragging-active .vd-zone-tray {
    overflow: visible !important;
}

.vd-lens-overlay .vd-zone-tray {
    max-height: 185px;
}

.vd-placed-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    background: #ffffff;
    border: 1.5px solid rgba(148, 163, 184, 0.65);
    border-radius: 10px;
    padding: 4px 8px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #1e293b;
    box-shadow: 0 2px 5px rgba(15, 23, 42, 0.08);
    cursor: grab;
    transition: transform 0.14s ease, border-color 0.14s ease, background-color 0.14s ease;
    touch-action: none;
}

.vd-placed-chip:hover {
    transform: translateY(-1px);
    border-color: #6366f1;
}

.vd-placed-chip.is-locked-correct {
    background: #ecfdf5;
    border-color: #10b981;
    color: #065f46;
    cursor: default;
}

.vd-placed-chip.is-wrong-flash {
    background: #fef2f2;
    border-color: #ef4444;
    color: #991b1b;
    animation: vdShake 0.38s ease;
}

.vd-placed-chip.is-exam-chip {
    background: #f8fafc;
    border-color: #64748b;
    color: #0f172a;
}

/* Open Outside-Both-Circles Placement Area (no inner border or title) */
.vd-tray-outside {
    width: 100%;
    min-height: 28px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 4px 6px 0;
}

/* Items Bank */
.vd-bank {
    width: 100%;
    min-height: 62px;
    background: rgba(248, 250, 252, 0.92);
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.vd-bank.is-empty {
    min-height: 44px;
    color: #059669;
    font-size: 0.85rem;
    font-weight: 700;
    background: rgba(236, 253, 245, 0.75);
    border-color: rgba(16, 185, 129, 0.35);
}

.vd-item-card {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ffffff;
    border: 2px solid #cbd5e1;
    border-radius: 12px;
    padding: 7px 12px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e293b;
    box-shadow: 0 3px 8px rgba(15, 23, 42, 0.08);
    cursor: grab;
    touch-action: none;
    transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
    max-width: 240px;
}

.vd-item-card:hover {
    border-color: #6366f1;
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(99, 102, 241, 0.16);
}

.vd-item-card.is-selected {
    border-color: #4f46e5;
    background: #eef2ff;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.22);
    transform: scale(1.03);
}

.vd-item-card.is-dragging {
    opacity: 0.95;
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.24);
    border-color: #4f46e5;
    z-index: 9999 !important;
    cursor: grabbing;
}

.vd-item-img {
    width: 34px;
    height: 34px;
    object-fit: cover;
    border-radius: 7px;
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
    pointer-events: none;
}

.vd-placed-chip .vd-item-img {
    width: 22px;
    height: 22px;
    border-radius: 5px;
}

.vd-chip-tts {
    background: transparent;
    border: none;
    padding: 0 2px;
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
    opacity: 0.72;
}

.vd-chip-tts:hover {
    opacity: 1;
}

/* Quick-Tap Helper Row when item is selected */
.vd-quick-bar {
    display: none;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 10px;
    background: #eef2ff;
    border: 1.5px solid #c7d2fe;
    border-radius: 12px;
}

.vd-quick-bar.is-visible {
    display: flex;
}

.vd-quick-btn {
    border: 1.5px solid #818cf8;
    background: #ffffff;
    color: #3730a3;
    border-radius: 8px;
    padding: 5px 11px;
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
    transition: background-color 0.14s ease, color 0.14s ease;
}

.vd-quick-btn:hover {
    background: #4f46e5;
    color: #ffffff;
}

/* Footer Controls & Educational Discovery Note */
.vd-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.vd-note-box {
    background: linear-gradient(135deg, #fefce8 0%, #fffbeb 100%);
    border: 1.5px solid #fcd34d;
    border-radius: 12px;
    padding: 10px 14px;
    color: #78350f;
    font-size: 0.88rem;
    font-weight: 700;
    text-align: center;
    line-height: 1.45;
}

@keyframes vdShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Responsive Tablet & Mobile */
@media (max-width: 680px) {
    .vd-circle {
        width: 266px;
        height: 266px;
        padding: 12px 16px 14px;
    }
    .vd-circle-a {
        margin-right: -36px;
        padding-right: 42px;
    }
    .vd-circle-b {
        margin-left: -36px;
        padding-left: 42px;
    }
    .vd-lens-overlay {
        width: 106px;
        min-height: 186px;
        max-height: 220px;
        border-radius: 44px;
    }
}

@media (max-width: 560px) {
    .vd-circles-row {
        flex-direction: column;
    }
    .vd-circle {
        width: 268px;
        height: 268px;
        padding: 14px 18px;
    }
    .vd-circle-a {
        margin-right: 0;
        padding-right: 18px;
        margin-bottom: -44px;
        padding-bottom: 48px;
    }
    .vd-circle-b {
        margin-left: 0;
        padding-left: 18px;
        margin-top: -44px;
        padding-top: 48px;
    }
    .vd-lens-overlay {
        width: 196px;
        min-height: 92px;
        max-height: 118px;
        border-radius: 42px;
        padding: 6px 10px;
    }
    .vd-lens-overlay .vd-zone-tray {
        max-height: 62px;
    }
}
