#difficulty-filter {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 0.25rem auto 0;
    padding: 6px 14px;
    background: #f4f3f9;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    width: fit-content;
}

.filter-label {
    font-size: 0.8rem;
    color: #495057;
    font-weight: 500;
}

.diff-btn {
    padding: 4px 14px;
    border: 1.5px solid #c5c0e0;
    border-radius: 6px;
    background: #fff;
    color: #6c757d;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.diff-btn:hover {
    border-color: #362A8D;
    color: #362A8D;
    background: #fff;
}

.diff-btn.active {
    background: #362A8D;
    border-color: #362A8D;
    color: white;
}

#problem-prompt {
    text-align: center;
    font-size: 1.1rem;
    margin: 0.5rem 0;
    color: #495057;
    font-weight: 500;
}

#build-layout {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin: 0.5rem auto;
    flex-wrap: wrap;
}

#structure-container {
    width: 280px;
    height: 280px;
}

#newman-work-area {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

#newman-container {
    width: 280px;
    position: relative;
}

#skeleton-toggle {
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    display: flex;
    gap: 6px;
}

.skeleton-btn {
    padding: 3px 12px;
    border: 1.5px solid #c5c0e0;
    border-radius: 5px;
    background: rgba(255,255,255,0.9);
    color: #6c757d;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.skeleton-btn:hover {
    border-color: #362A8D;
    color: #362A8D;
}

.skeleton-btn.active {
    background: #362A8D;
    border-color: #362A8D;
    color: white;
}

#newman-svg {
    width: 100%;
    height: auto;
    touch-action: none;
    cursor: grab;
}

#newman-svg:active {
    cursor: grabbing;
}

#newman-bottom-overlay {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    text-align: center;
}

#rotate-hint {
    font-size: 0.72rem;
    color: #aaa;
    pointer-events: none;
    letter-spacing: 0.02em;
}

/* Answer toggle (Correct / Yours) — overlaid at bottom of Newman */
#answer-toggle {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.answer-toggle-btn {
    padding: 3px 12px;
    border: 1.5px solid #ccc;
    border-radius: 5px;
    background: rgba(255,255,255,0.9);
    color: #6c757d;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.answer-toggle-btn[data-show="correct"] {
    border-color: #28a745;
    color: #28a745;
}

.answer-toggle-btn[data-show="correct"].active {
    background: #28a745;
    color: white;
}

.answer-toggle-btn[data-show="yours"] {
    border-color: #dc3545;
    color: #dc3545;
}

.answer-toggle-btn[data-show="yours"].active {
    background: #dc3545;
    color: white;
}

/* Carbon number labels on RDKit structure — ~50% of atom label size */
.carbon-label {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 20px;
    font-weight: 600;
    fill: #362A8D;
}

/* Newman diagram elements */
.newman-back-circle {
    fill: none;
    stroke: #333;
    stroke-width: 2;
}

.newman-front-dot {
    fill: #333;
}

.newman-bond {
    stroke: #333;
    stroke-width: 2;
}

.newman-bond.back {
    stroke: #666;
}

/* Drop targets */
.drop-target {
    cursor: pointer;
}

.drop-target rect {
    fill: #f4f3f9;
    stroke: #c5c0e0;
    stroke-width: 1.5;
    stroke-dasharray: 4 3;
    rx: 4;
    ry: 4;
    transition: fill 0.15s, stroke 0.15s;
}

.drop-target:hover rect,
.drop-target.drag-over rect {
    fill: #e8e5f5;
    stroke: #362A8D;
}

.drop-target.filled rect {
    fill: #fff;
    stroke: #362A8D;
    stroke-dasharray: none;
}

.drop-target .placeholder {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    fill: #c5c0e0;
    dominant-baseline: central;
    text-anchor: middle;
    pointer-events: none;
}

.drop-target .label-text {
    font-family: Arial, sans-serif;
    font-size: 16px;
    dominant-baseline: central;
    pointer-events: none;
}

/* Front/back indicator labels */
.position-label {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 11px;
    fill: #999;
    dominant-baseline: central;
    pointer-events: none;
}

/* Tile tray — vertical column beside Newman */
#tile-tray {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 6px;
    min-width: 56px;
    border: 1px dashed #dee2e6;
    border-radius: 8px;
    background: #f8f9fa;
    align-items: center;
}


.tile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    min-width: 44px;
    background: #fff;
    border: 2px solid #333;
    border-radius: 8px;
    font-family: Arial, sans-serif;
    font-size: 16px;
    color: #333;
    cursor: grab;
    user-select: none;
    touch-action: none;
    transition: transform 0.1s, box-shadow 0.1s;
}

.tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.tile.dragging {
    opacity: 0.4;
}

.tile-ghost {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    padding: 8px 16px;
    background: #fff;
    border: 2px solid #333;
    border-radius: 8px;
    font-family: Arial, sans-serif;
    font-size: 16px;
    color: #333;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    transform: translate(-50%, -50%);
}

/* Check button */
#check-btn {
    min-width: 140px;
    padding: 10px 30px;
}

/* Correct/incorrect coloring on drop targets */
.drop-target.correct rect {
    fill: #d4edda;
    stroke: #28a745;
    stroke-dasharray: none;
}

/* Incorrect slots flash between wrong (red) and correct (green) */
.drop-target.show-wrong rect {
    fill: #f8d7da;
    stroke: #dc3545;
    stroke-dasharray: none;
}

.drop-target.show-correct rect {
    fill: #d4edda;
    stroke: #28a745;
    stroke-dasharray: none;
}

.drop-target.show-wrong .label-text {
    fill: #dc3545;
}

.drop-target.show-correct .label-text {
    fill: #28a745;
}

@media (max-width: 650px) {
    #build-layout {
        flex-direction: column;
    }

    #structure-container {
        width: 260px;
        height: 260px;
    }

    #newman-work-area {
        flex-direction: column;
        align-items: center;
    }

    #newman-container {
        width: 260px;
    }

    #tile-tray {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        min-width: unset;
        width: 100%;
    }
}
