/* Scoped Styles with increased specificity to prevent bleed */
.fitts-law-experiment-widget {
    font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4) !important;
    overflow: hidden !important;
    width: 100% !important;
    max-width: 810px !important; /* Fixed Width */
	min-width: 810px !important;
    margin: 0 auto !important;
    color: #1e293b !important;
    box-sizing: border-box !important;
    line-height: 1.5 !important;
    text-align: left !important;
}

/* Ensure box-sizing is consistent inside the widget */
.fitts-law-experiment-widget * {
    box-sizing: border-box !important;
}

/* Header */
.fle-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important; 
    padding: 0 0 12px 0 !important; /* Reduced bottom gap */
    background: transparent !important;
    border-bottom: 1px solid #e2e8f0 !important;
    margin-bottom: 12px !important;
    width: 100% !important;
	margin-top: 14px !important;
}

.fle-header-left {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}

.fle-header h2 {
    margin: 0 !important;
    font-size: 1rem !important; 
    font-weight: 600 !important;
    color: #0f172a !important;
    line-height: 1.2 !important;
}

.fle-header i {
    color: #3b82f6 !important;
    width: 18px !important;
    height: 18px !important;
}

/* Debug Toggle Styles */
.fle-debug-toggle {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-size: 0.75rem !important;
    color: #64748b !important;
    cursor: pointer !important;
    font-weight: normal !important;
}
.fle-debug-toggle input {
    cursor: pointer !important;
    margin: 0 !important;
}

/* Intro Section */
.fle-intro {
    font-size: 0.8rem !important;
    color: #475569 !important;
    margin-bottom: 20px !important;
    line-height: 1.4 !important;
}

.fle-intro p {
    margin: 0 0 8px 0 !important;
}

.fle-intro ul {
    margin: 0 !important;
    padding-left: 18px !important;
}

.fle-intro li {
    margin-bottom: 4px !important;
}

/* Layout - Horizontal Change */
.fle-container {
    padding: 8px 16px !important; /* Compact padding */
    display: grid !important;
    grid-template-columns: 220px 1fr !important; /* 220px fixed sidebar, rest for experiment */
    gap: 20px !important;
    align-items: center !important;
}

/* Sidebar Container (Intro + Controls) */
.fle-sidebar {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
}

/* Controls Column (Left Sidebar) */
.fle-controls {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    padding-bottom: 0 !important;
    border-bottom: none !important;
}

.fle-col-sliders, .fle-col-actions {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important; /* Compact spacing */
    width: 100% !important;
    margin-bottom: 12px !important;
}

.fle-controls > * {
    width: 100% !important;
}

.fle-control-group {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important; /* Compact gap */
}

.fle-control-group label {
    font-size: 0.8rem !important;
    font-weight: 500 !important;
    color: #64748b !important;
    margin-bottom: 0 !important;
    display: inline-block !important;
}

.fle-control-group input[type="range"] {
    width: 100% !important;
    cursor: pointer !important;
    margin: 0 !important;
    display: block !important;
    height: auto !important;
    padding: 0 !important;
}

.fle-control-group select {
    padding: 6px 8px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 4px !important;
    background: white !important;
    font-size: 0.85rem !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    display: block !important;
}

.fle-start-btn {
    background: #3b82f6 !important;
    color: white !important;
    border: none !important;
    padding: 10px !important;
    border-radius: 6px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: background 0.2s !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    width: 100% !important;
    text-align: center !important;
    font-size: 0.9rem !important;
    line-height: 1.2 !important;
    margin-top: 8px !important;
}

.fle-start-btn i {
    width: 16px !important; 
    height: 16px !important;
}

.fle-start-btn:hover {
    background: #2563eb !important;
}

.fle-start-btn:disabled {
    background: #94a3b8 !important;
    cursor: not-allowed !important;
    opacity: 0.7 !important;
}

.fle-reset-btn {
    height: auto !important;
    flex-grow: 0 !important;
    margin-top: 10px !important;
    padding: 8px 16px !important;
    width: 100% !important;
    font-size: 0.85rem !important;
}

/* Experiment Area */
.fle-experiment-area {
    width: 100% !important;
    aspect-ratio: 1 / 1 !important;
    background: #f1f5f9 !important;
    border: 2px dashed #cbd5e1 !important;
    border-radius: 8px !important;
    position: relative !important;
    overflow: hidden !important;
    cursor: crosshair !important;
    user-select: none !important;
}

.fle-target {
    position: absolute !important;
    background: rgba(59, 130, 246, 0.2) !important;
    border: 2px solid #3b82f6 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transform: translate(-50%, -50%) !important;
    cursor: pointer !important;
    box-sizing: border-box !important;
    z-index: 10 !important;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                top 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                width 0.3s ease, 
                height 0.3s ease, 
                border-radius 0.2s !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* VISUAL DEBUG BOUNDARIES */
.fitts-law-experiment-widget.debug .fle-target::before {
    content: '' !important;
    position: absolute !important;
    top: 50% !important; left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: var(--bound-d) !important;
    height: var(--bound-d) !important;
    border: 1px dashed rgba(239, 68, 68, 0.6) !important;
    background: rgba(239, 68, 68, 0.05) !important;
    border-radius: 50% !important;
    pointer-events: none !important;
    z-index: -1 !important;
    display: block !important;
}

.fle-target.active {
    background: #3b82f6 !important;
    border-color: #1d4ed8 !important;
    z-index: 20 !important;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5) !important;
}

.fle-target.clicked {
    background: #22c55e !important;
    border-color: #15803d !important;
    opacity: 0.5 !important;
    pointer-events: none !important;
}

/* Concentric Rings */
.fle-ring-middle, .fle-ring-center {
    position: absolute !important;
    border-radius: 50% !important;
    border: 1px solid rgba(255,255,255,0.5) !important;
    pointer-events: none !important;
    transition: border-radius 0.2s ease !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    margin: 0 !important;
}

.fle-ring-middle { width: 66% !important; height: 66% !important; }
.fle-ring-center { width: 33% !important; height: 33% !important; background: rgba(255,255,255,0.2) !important; }

/* Target Shapes */
.fle-shape-circle, .fle-shape-circle .fle-ring-middle, .fle-shape-circle .fle-ring-center { border-radius: 50% !important; }
.fle-shape-square, .fle-shape-square .fle-ring-middle, .fle-shape-square .fle-ring-center { border-radius: 0 !important; }
.fle-shape-rect-h, .fle-shape-rect-h .fle-ring-middle, .fle-shape-rect-h .fle-ring-center { border-radius: 0 !important; }
.fle-shape-rect-v, .fle-shape-rect-v .fle-ring-middle, .fle-shape-rect-v .fle-ring-center { border-radius: 0 !important; }
/* For Diamond, we rotate the target DIV itself */
.fle-shape-diamond { transform: translate(-50%, -50%) rotate(45deg) !important; }
.fle-shape-diamond .fle-ring-middle, .fle-shape-diamond .fle-ring-center { border-radius: 0 !important; }

/* Results Screen */
.fle-results {
    position: absolute !important;
    inset: 0 !important;
    background: rgba(255,255,255,0.98) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 10px !important;
    text-align: center !important;
    z-index: 100 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.3s ease !important;
    overflow-y: auto !important;
}

.fle-results.visible {
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* New Results Banner */
.fle-results-banner {
    width: 100% !important;
    max-width: 480px !important;
    background-color: #dcfce7 !important;
    border: 1px solid #86efac !important;
    color: #15803d !important;
    font-weight: bold !important;
    font-size: 1.1rem !important;
    padding: 8px 0 !important;
    margin-bottom: 15px !important;
    border-radius: 4px !important;
    text-align: center !important;
}

.fle-results-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
    width: 100% !important;
    max-width: 480px !important;
    margin-bottom: 15px !important;
    text-align: left !important;
    line-height: 1.2rem !important;
}

.fle-stat-label { 
    color: #64748b !important; 
    font-size: 0.8rem !important; 
    display: block !important;
}
.fle-stat-value { 
    font-weight: 600 !important; 
    text-align: right !important; 
    font-family: monospace !important; 
    display: block !important;
    color: #1e293b !important;
    font-size: 0.9rem !important;
}

/* NEW: Container for side-by-side metric boxes */
.fle-metrics-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
    width: 100% !important;
    max-width: 480px !important;
    margin-bottom: 10px !important;
}

.fle-id-box {
    background: #f0f9ff !important;
    border: 1px solid #bae6fd !important;
    padding: 10px !important;
    border-radius: 6px !important;
    margin-bottom: 0 !important; 
    width: 100% !important;
    line-height: 1.1rem !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
}

.fle-id-box h4 {
    font-weight: bold !important;
    font-size: 0.9rem !important;
    margin: 0 0 5px 0 !important;
    color: #0f172a !important;
}

.fle-id-calc {
    font-family: monospace !important;
    font-size: 0.8rem !important;
    color: #0369a1 !important;
    margin-top: 2px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.val-id, .val-tp, .val-mt, .val-acc-box {
    font-size: 1.2rem !important;
    font-weight: bold !important; 
    color: #0284c7 !important;
    margin-top: 2px !important;
}

.fle-accuracy-box {
    margin-bottom: 12px !important;
    color: #334155 !important;
    font-size: 0.9rem !important;
}