/* --- Problem Header --- */
#problem-header {
    font-size: 1.1rem;
    font-weight: 600;
    color: #444;
    margin: 0.5em 0;
    text-align: center;
}

/* --- Side-by-side panels --- */
#problem-panels {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8em;
    margin: 1em auto;
}

#panel-arrow {
    font-size: 1.8rem;
    color: #999;
    user-select: none;
    flex-shrink: 0;
}

/* --- Molecule Drawing Area --- */
#molecule-area {
    position: relative;
    width: 450px;
    height: 350px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: white;
    cursor: crosshair;
    touch-action: none; /* prevent scroll while drawing */
    user-select: none;
    flex-shrink: 0;
}

#mol-container {
    width: 100%;
    height: 100%;
}

#mol-container svg {
    width: 100%;
    height: 100%;
}

#arrow-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* let events pass through to molecule-area */
}

/* --- Target Panel --- */
#target-container {
    width: 300px;
    height: 250px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: white;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: border-color 0.3s ease;
}

#target-container.correct-flash {
    border-color: #2a9d8f;
    box-shadow: 0 0 8px rgba(42, 157, 143, 0.3);
}

#target-label {
    font-size: 0.8rem;
    color: #888;
    text-align: center;
    padding: 4px 0 0;
    user-select: none;
}

#target-mol {
    flex: 1;
    min-height: 0;
}

#target-mol svg {
    width: 100%;
    height: 100%;
}

/* --- Drawn Arrows --- */
.arrow-path {
    fill: none;
    stroke: #6153cc;
    stroke-width: 2.5;
    stroke-linecap: round;
}

.arrow-head {
    fill: #6153cc;
    stroke: none;
}

.freehand-stroke {
    fill: none;
    stroke: #6153cc;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-dasharray: 4 3;
    opacity: 0.6;
}

/* --- Snap indicators --- */
.snap-indicator {
    fill: none;
    stroke: #6153cc;
    stroke-width: 2;
    opacity: 0.5;
}

.snap-indicator.snapped {
    stroke: #2a9d8f;
    opacity: 0.8;
}

/* --- Hit targets (invisible, pointer-events: none on overlay) --- */
.atom-target {
    fill: transparent;
    stroke: none;
}

.bond-target {
    fill: transparent;
    stroke: transparent;
    stroke-width: 12;
}

/* --- Hover indicator (shown before clicking to indicate snap target) --- */
.hover-indicator {
    fill: rgba(42, 157, 143, 0.12);
    stroke: #2a9d8f;
    stroke-width: 1.5;
    opacity: 0.7;
}

/* --- Undo button (overlaid on molecule area) --- */
#undo-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #ccc;
    background: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 32px;
    text-align: center;
    padding: 0;
    color: #555;
    z-index: 10;
    display: none;
}

#undo-btn:hover,
#zoom-reset-btn:hover {
    background: rgba(255, 255, 255, 1);
    border-color: #999;
    color: #222;
}

#zoom-reset-btn {
    position: absolute;
    top: 8px;
    right: 48px;
    height: 32px;
    border-radius: 16px;
    border: 1px solid #ccc;
    background: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    font-size: 0.75rem;
    line-height: 32px;
    text-align: center;
    padding: 0 10px;
    color: #555;
    z-index: 10;
    display: none;
}

/* --- Controls --- */
#game-controls {
    margin: 1em 0;
    text-align: center;
}

#check-btn {
    background-color: #2a9d8f;
    min-width: 140px;
}

#skip-btn {
    background-color: #bbc8ca;
    min-width: 100px;
}

#skip-btn.next-ready {
    background-color: #333;
}

/* --- Feedback --- */
#feedback-message {
    min-height: 30px;
    font-size: 1.1rem;
    font-weight: bold;
    margin: 0.5em 0;
}

/* --- Responsive --- */
@media (max-width: 800px) {
    #problem-panels {
        flex-direction: column;
    }
    #panel-arrow {
        transform: rotate(90deg);
        font-size: 1.4rem;
        margin: -0.3em 0;
    }
    #target-container {
        width: 300px;
        height: 200px;
        order: -1; /* target on top */
    }
}

@media (max-width: 500px) {
    #molecule-area {
        width: 100%;
        height: 300px;
    }
    #target-container {
        width: 100%;
        height: 200px;
    }
}
